composer.phar 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988889898899088991889928899388994889958899688997889988899989000890018900289003890048900589006890078900889009890108901189012890138901489015890168901789018890198902089021890228902389024890258902689027890288902989030890318903289033890348903589036890378903889039890408904189042890438904489045890468904789048890498905089051890528905389054890558905689057890588905989060890618906289063890648906589066890678906889069890708907189072890738907489075890768907789078890798908089081890828908389084890858908689087890888908989090890918909289093890948909589096890978909889099891008910189102891038910489105891068910789108891098911089111891128911389114891158911689117891188911989120891218912289123891248912589126891278912889129891308913189132891338913489135891368913789138891398914089141891428914389144891458914689147891488914989150891518915289153891548915589156891578915889159891608916189162891638916489165891668916789168891698917089171891728917389174891758917689177891788917989180891818918289183891848918589186891878918889189891908919189192891938919489195891968919789198891998920089201892028920389204892058920689207892088920989210892118921289213892148921589216892178921889219892208922189222892238922489225892268922789228892298923089231892328923389234892358923689237892388923989240892418924289243892448924589246892478924889249892508925189252892538925489255892568925789258892598926089261892628926389264892658926689267892688926989270892718927289273892748927589276892778927889279892808928189282892838928489285892868928789288892898929089291892928929389294892958929689297892988929989300893018930289303893048930589306893078930889309893108931189312893138931489315893168931789318893198932089321893228932389324893258932689327893288932989330893318933289333893348933589336893378933889339893408934189342893438934489345893468934789348893498935089351893528935389354893558935689357893588935989360893618936289363893648936589366893678936889369893708937189372893738937489375893768937789378893798938089381893828938389384893858938689387893888938989390893918939289393893948939589396893978939889399894008940189402894038940489405894068940789408894098941089411894128941389414894158941689417894188941989420894218942289423894248942589426894278942889429894308943189432894338943489435894368943789438894398944089441894428944389444894458944689447894488944989450894518945289453894548945589456894578945889459894608946189462894638946489465894668946789468894698947089471894728947389474894758947689477894788947989480894818948289483894848948589486894878948889489894908949189492894938949489495894968949789498894998950089501895028950389504895058950689507895088950989510895118951289513895148951589516895178951889519895208952189522895238952489525895268952789528895298953089531895328953389534895358953689537895388953989540895418954289543895448954589546895478954889549895508955189552895538955489555895568955789558895598956089561895628956389564895658956689567895688956989570895718957289573895748957589576895778957889579895808958189582895838958489585895868958789588895898959089591895928959389594895958959689597895988959989600896018960289603896048960589606896078960889609896108961189612896138961489615896168961789618896198962089621896228962389624896258962689627896288962989630896318963289633896348963589636896378963889639896408964189642896438964489645896468964789648896498965089651896528965389654896558965689657896588965989660896618966289663896648966589666896678966889669896708967189672896738967489675896768967789678896798968089681896828968389684896858968689687896888968989690896918969289693896948969589696896978969889699897008970189702897038970489705897068970789708897098971089711897128971389714897158971689717897188971989720897218972289723897248972589726897278972889729897308973189732897338973489735897368973789738897398974089741897428974389744897458974689747897488974989750897518975289753897548975589756897578975889759897608976189762897638976489765897668976789768897698977089771897728977389774897758977689777897788977989780897818978289783897848978589786897878978889789897908979189792897938979489795897968979789798897998980089801898028980389804898058980689807898088980989810898118981289813898148981589816898178981889819898208982189822898238982489825898268982789828898298983089831898328983389834898358983689837898388983989840898418984289843898448984589846898478984889849898508985189852898538985489855898568985789858898598986089861898628986389864898658986689867898688986989870898718987289873898748987589876898778987889879898808988189882898838988489885898868988789888898898989089891898928989389894898958989689897898988989989900899018990289903899048990589906899078990889909899108991189912899138991489915899168991789918899198992089921899228992389924899258992689927899288992989930899318993289933899348993589936899378993889939899408994189942899438994489945899468994789948899498995089951899528995389954899558995689957899588995989960899618996289963899648996589966899678996889969899708997189972899738997489975899768997789978899798998089981899828998389984899858998689987899888998989990899918999289993899948999589996899978999889999900009000190002900039000490005900069000790008900099001090011900129001390014900159001690017900189001990020900219002290023900249002590026900279002890029900309003190032900339003490035900369003790038900399004090041900429004390044900459004690047900489004990050900519005290053900549005590056900579005890059900609006190062900639006490065900669006790068900699007090071900729007390074900759007690077900789007990080900819008290083900849008590086900879008890089900909009190092900939009490095900969009790098900999010090101901029010390104901059010690107901089010990110901119011290113901149011590116901179011890119901209012190122901239012490125901269012790128901299013090131901329013390134901359013690137901389013990140901419014290143901449014590146901479014890149901509015190152901539015490155901569015790158901599016090161901629016390164901659016690167901689016990170901719017290173901749017590176901779017890179901809018190182901839018490185901869018790188901899019090191901929019390194901959019690197901989019990200902019020290203902049020590206902079020890209902109021190212902139021490215902169021790218902199022090221902229022390224902259022690227902289022990230902319023290233902349023590236902379023890239902409024190242902439024490245902469024790248902499025090251902529025390254902559025690257902589025990260902619026290263902649026590266902679026890269902709027190272902739027490275902769027790278902799028090281902829028390284902859028690287902889028990290902919029290293902949029590296902979029890299903009030190302903039030490305903069030790308903099031090311903129031390314903159031690317903189031990320903219032290323903249032590326903279032890329903309033190332903339033490335903369033790338903399034090341903429034390344903459034690347903489034990350903519035290353903549035590356903579035890359903609036190362903639036490365903669036790368903699037090371903729037390374903759037690377903789037990380903819038290383903849038590386903879038890389903909039190392903939039490395903969039790398903999040090401904029040390404904059040690407904089040990410904119041290413904149041590416904179041890419904209042190422904239042490425904269042790428904299043090431904329043390434904359043690437904389043990440904419044290443904449044590446904479044890449904509045190452904539045490455904569045790458904599046090461904629046390464904659046690467904689046990470904719047290473904749047590476904779047890479904809048190482904839048490485904869048790488904899049090491904929049390494904959049690497904989049990500905019050290503905049050590506905079050890509905109051190512905139051490515905169051790518905199052090521905229052390524905259052690527905289052990530905319053290533905349053590536905379053890539905409054190542905439054490545905469054790548905499055090551905529055390554905559055690557905589055990560905619056290563905649056590566905679056890569905709057190572905739057490575
  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') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  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.phpüc��%‡D]üc��ÊÇv`¶������+���src/Composer/Autoload/ClassMapGenerator.php–��%‡D]–��¤>Pz¶���������src/Composer/Cache.phpç��%‡D]ç��³›î¶������%���src/Composer/Command/AboutCommand.phpÍ��%‡D]Í��ÿÌŒ4¶������'���src/Composer/Command/ArchiveCommand.phpž��%‡D]ž��lG¶������$���src/Composer/Command/BaseCommand.phpÜ ��%‡D]Ü ��gô1¶������.���src/Composer/Command/BaseDependencyCommand.phpñ��%‡D]ñ��XgFð¶������1���src/Composer/Command/CheckPlatformReqsCommand.php ��%‡D] ��*Þ¯T¶������*���src/Composer/Command/ClearCacheCommand.phpª��%‡D]ª��Ȩ J¶������&���src/Composer/Command/ConfigCommand.phpÎL��%‡D]ÎL��m£1Ķ������-���src/Composer/Command/CreateProjectCommand.phpß5��%‡D]ß5��ü�_÷¶������'���src/Composer/Command/DependsCommand.phpø��%‡D]ø��ªeá¶������(���src/Composer/Command/DiagnoseCommand.phpåM��%‡D]åM��hÇÔ¶������,���src/Composer/Command/DumpAutoloadCommand.phpA ��%‡D]A ��Ò)šN¶������$���src/Composer/Command/ExecCommand.phpï��%‡D]ï��Xrœ¾¶������&���src/Composer/Command/GlobalCommand.phpz ��%‡D]z ��³çå?¶������$���src/Composer/Command/HomeCommand.php��%‡D]��qLBŽ¶������$���src/Composer/Command/InitCommand.php¤Q��%‡D]¤Q��,±'¨¶������'���src/Composer/Command/InstallCommand.phpT��%‡D]T��Þùõ›¶������(���src/Composer/Command/LicensesCommand.phpw��%‡D]w��š˜V¶������(���src/Composer/Command/OutdatedCommand.php ��%‡D] ��Uý@]¶������)���src/Composer/Command/ProhibitsCommand.php��%‡D]��_¤éS¶������&���src/Composer/Command/RemoveCommand.phpá��%‡D]á��½í�)¶������'���src/Composer/Command/RequireCommand.php
  25. &��%‡D]
  26. &��ŽVXZ¶������)���src/Composer/Command/RunScriptCommand.php=��%‡D]=��rºmܶ������+���src/Composer/Command/ScriptAliasCommand.php¯��%‡D]¯��?=Ѷ������&���src/Composer/Command/SearchCommand.phpJ ��%‡D]J ��lºo¶������*���src/Composer/Command/SelfUpdateCommand.php03��%‡D]03��j.­ ¶������$���src/Composer/Command/ShowCommand.phphq��%‡D]hq��+a_¶������&���src/Composer/Command/StatusCommand.php–��%‡D]–��ùjض������(���src/Composer/Command/SuggestsCommand.phpå ��%‡D]å ��Þ=¶������&���src/Composer/Command/UpdateCommand.phpñ#��%‡D]ñ#��p\F¶������(���src/Composer/Command/ValidateCommand.php€��%‡D]€��ÍÃ�î¶���������src/Composer/Composer.phpN ��%‡D]N ��u)s ¶���������src/Composer/Config.phph$��%‡D]h$��»‰Á¶������-���src/Composer/Config/ConfigSourceInterface.php��%‡D]��³ [/¶������(���src/Composer/Config/JsonConfigSource.php²��%‡D]²��QiÃb¶������$���src/Composer/Console/Application.phpÞ6��%‡D]Þ6��"ãí5¶������,���src/Composer/Console/HtmlOutputFormatter.php3��%‡D]3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.php'��%‡D]'��¹ÔŽ¼¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��%‡D]��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.phpµ��%‡D]µ��᫤¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��%‡D]C��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��%‡D]÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��%‡D]ý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���%‡D]Ó���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��%‡D]¹��&¢e
  27. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��%‡D]I��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��%‡D]h��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��%‡D]­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php¯"��%‡D]¯"��m½ ¶������+���src/Composer/DependencyResolver/Problem.phpú��%‡D]ú��]D5¶������+���src/Composer/DependencyResolver/Request.phpƒ��%‡D]ƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php?��%‡D]?��¬‘œü¶������1���src/Composer/DependencyResolver/Rule2Literals.php��%‡D]��tZÅɶ������+���src/Composer/DependencyResolver/RuleSet.phpª
  28. ��%‡D]ª
  29. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpÊ��%‡D]Ê��D¦õZ¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��%‡D]��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��%‡D]i��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��%‡D]á��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.php��%‡D]���Gd7¶������*���src/Composer/DependencyResolver/Solver.php�:��%‡D]�:��æ¯Ép¶������6���src/Composer/DependencyResolver/SolverBugException.php™��%‡D]™��Xg6¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��%‡D]ô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.php×��%‡D]×��Vm쟶������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��%‡D]Æ ��G s0¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���%‡D]Ì���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��%‡D]`��#ÏX¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��%‡D]Ê��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���%‡D]Ñ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpG��%‡D]G��äOж������/���src/Composer/Downloader/FilesystemException.php
  30. ��%‡D]
  31. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php‚ ��%‡D]‚ ��Ü�Ii¶������)���src/Composer/Downloader/GitDownloader.php¤4��%‡D]¤4��³ÎÓâ¶������*���src/Composer/Downloader/GzipDownloader.phpó��%‡D]ó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php”��%‡D]”��ßis̶������*���src/Composer/Downloader/PathDownloader.phpé��%‡D]é��$²FQ¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��%‡D]u��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.phpž��%‡D]ž��Öüñ9¶������*���src/Composer/Downloader/PharDownloader.phpå���%‡D]å���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��%‡D]ž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��%‡D]G��M#j¶������)���src/Composer/Downloader/TarDownloader.phpã���%‡D]ã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��%‡D]=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���%‡D]Ô���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php¡��%‡D]¡��( à>¶������(���src/Composer/Downloader/XzDownloader.php§��%‡D]§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpk��%‡D]k��Òo”ζ������&���src/Composer/EventDispatcher/Event.php ��%‡D] ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.php$4��%‡D]$4��x‹@¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���%‡D]©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���%‡D]v���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���%‡D]f���ËíM�¶���������src/Composer/Factory.php_=��%‡D]_=��x"Ŷ���������src/Composer/IO/BaseIO.phpÝ��%‡D]Ý��¢âº¶���������src/Composer/IO/BufferIO.php¾��%‡D]¾��X~d¶���������src/Composer/IO/ConsoleIO.php7��%‡D]7��¥<ȶ���������src/Composer/IO/IOInterface.phpì��%‡D]ì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��%‡D]À��F`sʶ���������src/Composer/Installer.phpÚž��%‡D]Úž��¾g«‰¶������*���src/Composer/Installer/BinaryInstaller.php
  32. ��%‡D]
  33. ��t¤{ø¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���%‡D]Ë���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��%‡D]-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��%‡D]��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���%‡D]Þ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��%‡D]ã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php%��%‡D]%�� »�̶������/���src/Composer/Installer/MetapackageInstaller.phpÊ��%‡D]Ê��Ùti·¶������(���src/Composer/Installer/NoopInstaller.php+��%‡D]+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��%‡D]e��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��%‡D]¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��%‡D]ø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��%‡D]¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.php‹��%‡D]‹��ÒX8¶������+���src/Composer/Installer/ProjectInstaller.php��%‡D]��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php:��%‡D]:��‚´UV¶���������src/Composer/Json/JsonFile.php[��%‡D][��°�Ë™¶������#���src/Composer/Json/JsonFormatter.phpb��%‡D]b��ÝNš¶������%���src/Composer/Json/JsonManipulator.phpÀ3��%‡D]À3���™ ¶������-���src/Composer/Json/JsonValidationException.php\��%‡D]\��.Xóܶ������%���src/Composer/Package/AliasPackage.php§��%‡D]§��Õ”R™¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��%‡D] ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��%‡D]Þ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��%‡D]Ý ��í<´B¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��%‡D]��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��%‡D]–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��%‡D]��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��%‡D]r��3‘Mh¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��%‡D] �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php?��%‡D]?��®— u¶������-���src/Composer/Package/Archiver/ZipArchiver.php½��%‡D]½��VÀ‚¨¶������$���src/Composer/Package/BasePackage.php��%‡D]��D|ŸÈ¶������*���src/Composer/Package/Comparer/Comparer.phpR��%‡D]R��Ïسî¶������(���src/Composer/Package/CompletePackage.phpü��%‡D]ü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��%‡D]õ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpW ��%‡D]W ��¿éÁ¦¶���������src/Composer/Package/Link.phpˆ��%‡D]ˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��%‡D]‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��%‡D]d��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��%‡D]‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��%‡D]i��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��%‡D]X��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.phpN��%‡D]N��âQ¬¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��%‡D]E��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��%‡D]ù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���%‡D]²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.phpó��%‡D]ó��l”.ض������5���src/Composer/Package/Loader/ValidatingArrayLoader.php(>��%‡D](>��„´P¶���������src/Composer/Package/Locker.php¥!��%‡D]¥!��/=xö¶������ ���src/Composer/Package/Package.phpÉ��%‡D]É��cÃ�h¶������)���src/Composer/Package/PackageInterface.php\��%‡D]\��xåp¨¶������)���src/Composer/Package/RootAliasPackage.php ��%‡D] �� _€ø¶������$���src/Composer/Package/RootPackage.php��%‡D]��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��%‡D]¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÏ��%‡D]Ï��ÌÂ߶������.���src/Composer/Package/Version/VersionParser.php¥��%‡D]¥��ô´à¶������0���src/Composer/Package/Version/VersionSelector.phpK ��%‡D]K ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���%‡D]W���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���%‡D]—���ûOâ>¶���������src/Composer/Plugin/Capable.php���%‡D]���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��%‡D]â��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpö���%‡D]ö���á1=z¶������'���src/Composer/Plugin/PluginInterface.phpô���%‡D]ô���)'*ض������%���src/Composer/Plugin/PluginManager.phpª$��%‡D]ª$��m‰ƒä¶������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��%‡D]õ��:ðd¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��%‡D]`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��%‡D]��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��%‡D]��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.phpí��%‡D]í��q9OS¶������*���src/Composer/Repository/BaseRepository.phpv ��%‡D]v ��„ÜL¶������.���src/Composer/Repository/ComposerRepository.php‡T��%‡D]‡T��Ž÷ƶ������/���src/Composer/Repository/CompositeRepository.php;��%‡D];��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���%‡D]…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.phpp��%‡D]p��#ù¶������4���src/Composer/Repository/InstalledArrayRepository.php£���%‡D]£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���%‡D]£���V
  34. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���%‡D]‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���%‡D]n���à“똶������-���src/Composer/Repository/PackageRepository.phpj��%‡D]j��¥ôò̶������*���src/Composer/Repository/PathRepository.php– ��%‡D]– ��WÛ¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��%‡D]I��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��%‡D]Ä��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��%‡D]í��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��%‡D]® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��%‡D]& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��%‡D]q��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��%‡D]q��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��%‡D]…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��%‡D]°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��%‡D]’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��%‡D]ª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.phpå��%‡D]å��»G÷å¶������-���src/Composer/Repository/RepositoryFactory.php`��%‡D]`��K¾du¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��%‡D]Û��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php2
  35. ��%‡D]2
  36. ��á…5#¶������7���src/Composer/Repository/RepositorySecurityException.phpo���%‡D]o���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.php” ��%‡D]” ��=QÞ¶������,���src/Composer/Repository/Vcs/FossilDriver.php³��%‡D]³��ÐCk¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��%‡D]ê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.phpu��%‡D]u��}Ýs!¶������,���src/Composer/Repository/Vcs/GitHubDriver.phpa)��%‡D]a)��8¸a¡¶������,���src/Composer/Repository/Vcs/GitLabDriver.php/%��%‡D]/%��å ¶������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��%‡D]ä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.phpL��%‡D]L��âX™•¶������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��%‡D]ù ��&½tÙ¶������)���src/Composer/Repository/Vcs/SvnDriver.php¤��%‡D]¤�� ¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  37. ��%‡D]æ
  38. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��%‡D]÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.phpÙ*��%‡D]Ù*��~Á£f¶������1���src/Composer/Repository/VersionCacheInterface.php”���%‡D]”���A?Rï¶������3���src/Composer/Repository/WritableArrayRepository.php��%‡D]��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��%‡D]‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���%‡D]W���£VZt¶���������src/Composer/Script/Event.phpº��%‡D]º��ò�»¤¶������$���src/Composer/Script/PackageEvent.phpœ���%‡D]œ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��%‡D]P��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���%‡D]��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��%‡D]ì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��%‡D]Ë��>zx–¶���������src/Composer/Util/Bitbucket.php*��%‡D]*��,Lšk¶������$���src/Composer/Util/ComposerMirror.php±��%‡D]±��­½øض������%���src/Composer/Util/ConfigValidator.php÷��%‡D]÷��v•Í¶������"���src/Composer/Util/ErrorHandler.php»��%‡D]»��O›rk¶������ ���src/Composer/Util/Filesystem.phpp/��%‡D]p/��#`_¶���������src/Composer/Util/Git.php2+��%‡D]2+��}rð¦¶���������src/Composer/Util/GitHub.php| ��%‡D]| ��`0tü¶���������src/Composer/Util/GitLab.php¬ ��%‡D]¬ ��B3 ë¶���������src/Composer/Util/Hg.php¾��%‡D]¾��LÓ �¶���������src/Composer/Util/IniHelper.phph��%‡D]h��;FP¶������$���src/Composer/Util/NoProxyPattern.php¾��%‡D]¾��Z+°m¶������#���src/Composer/Util/PackageSorter.phpÞ��%‡D]Þ��ê×ìY¶���������src/Composer/Util/Perforce.php¸2��%‡D]¸2��Ás&}¶���������src/Composer/Util/Platform.phpü��%‡D]ü��s­fç¶������%���src/Composer/Util/ProcessExecutor.phpl ��%‡D]l ��m7_š¶������&���src/Composer/Util/RemoteFilesystem.phpn��%‡D]n��r¸iS¶���������src/Composer/Util/Silencer.phpé��%‡D]é��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��%‡D]��¾7
  39. ñ¶������*���src/Composer/Util/StreamContextFactory.php��%‡D]��CÉ…ù¶���������src/Composer/Util/Svn.php,��%‡D],��Ì žÄ¶���������src/Composer/Util/TlsHelper.phpL
  40. ��%‡D]L
  41. ��" i¶���������src/Composer/Util/Url.php£��%‡D]£��3œÉܶ���������src/Composer/Util/Zip.php´��%‡D]´��°³¶¶���������src/Composer/XdebugHandler.phpð��%‡D]ð��zÓf~¶���������src/bootstrap.php¹��%‡D]¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php“4��%‡D]“4��²z�–¶������#���res/composer-repository-schema.jsonð��%‡D]ð���GÐà¶���������res/composer-schema.json´—��%‡D]´—��,�!Š¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json%
  42. ��%‡D]%
  43. ��ïBð¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonÓ˜��%‡D]Ó˜��Id¤÷¶������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��%‡D]�$��•�¥v¶������&���vendor/symfony/console/Application.php=X��%‡D]=X��� S’¶������*���vendor/symfony/console/Command/Command.phpî"��%‡D]î"��x°jÕ¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��%‡D]Ø��¦Ú-:¶������.���vendor/symfony/console/Command/ListCommand.phpZ��%‡D]Z��»w`¶������(���vendor/symfony/console/ConsoleEvents.phpé���%‡D]é���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��%‡D]Ð��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.php���%‡D]���¿N•¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���%‡D]ü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��%‡D]Ü ��*û�ɶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��%‡D]¶��·Ô;ݶ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��%‡D]¼��òç$¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��%‡D]��b{<¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��%‡D]°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��%‡D]Å��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��%‡D]��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��%‡D]z��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��%‡D]Ô��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���%‡D]f���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���%‡D]¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���%‡D]¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���%‡D]’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���%‡D]–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php6��%‡D]6��?=¨¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��%‡D]Œ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��%‡D]F��𦴶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��%‡D]„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��%‡D]@��G¨ýU¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��%‡D]y��Ì8Æж������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��%‡D]w��|¦C¶������.���vendor/symfony/console/Helper/DialogHelper.php��%‡D]��¹ÜÃ_¶������1���vendor/symfony/console/Helper/FormatterHelper.phpd��%‡D]d��§×,¸¶������(���vendor/symfony/console/Helper/Helper.php«��%‡D]«��!�§—¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���%‡D]å���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÊ��%‡D]Ê��áÏW"¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��%‡D]c��Ìøƒ¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��%‡D]Ó ��©w‚R¶������-���vendor/symfony/console/Helper/ProgressBar.phpl%��%‡D]l%�� díÛ¶������0���vendor/symfony/console/Helper/ProgressHelper.php]��%‡D]]��ù»‰X¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��%‡D]N��ÿ§³l¶������0���vendor/symfony/console/Helper/QuestionHelper.phpl��%‡D]l��Ntó¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  44. ��%‡D]–
  45. ��- ض������'���vendor/symfony/console/Helper/Table.phpÄ*��%‡D]Ä*��¾™ØT¶������+���vendor/symfony/console/Helper/TableCell.php���%‡D]���åV^¶������-���vendor/symfony/console/Helper/TableHelper.php ��%‡D] ��›uô™¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���%‡D]Ê���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  46. ��%‡D]
  47. ��_ÍI"¶������*���vendor/symfony/console/Input/ArgvInput.php��%‡D]��×ö†›¶������+���vendor/symfony/console/Input/ArrayInput.php) ��%‡D]) ��¥ÑC¶������&���vendor/symfony/console/Input/Input.php£ ��%‡D]£ ��f¡?¶������.���vendor/symfony/console/Input/InputArgument.php��%‡D]��D £¶������4���vendor/symfony/console/Input/InputAwareInterface.php˜���%‡D]˜���­O°¶������0���vendor/symfony/console/Input/InputDefinition.php†��%‡D]†��¤U)¤¶������/���vendor/symfony/console/Input/InputInterface.php£��%‡D]£��ÆBŒ'¶������,���vendor/symfony/console/Input/InputOption.php ��%‡D] ��\¢Ü=¶������,���vendor/symfony/console/Input/StringInput.phpš��%‡D]š��žµ è¶���������vendor/symfony/console/LICENSE)��%‡D])��NUN½¶������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��%‡D]0 ��…� ¸¶������0���vendor/symfony/console/Output/BufferedOutput.php_��%‡D]_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php±��%‡D]±��nì!f¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���%‡D]à���‡†Æʶ������,���vendor/symfony/console/Output/NullOutput.phpÏ��%‡D]Ï��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��%‡D]˜ ��0p¶������1���vendor/symfony/console/Output/OutputInterface.php��%‡D]���ì&¶������.���vendor/symfony/console/Output/StreamOutput.php���%‡D]���Ä’Oç¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  48. ��%‡D]x
  49. ��W€!¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��%‡D]è��/Ô�¶������,���vendor/symfony/console/Question/Question.phpÎ ��%‡D]Î ��lF¶������ ���vendor/symfony/console/Shell.phpæ��%‡D]æ��¼XÒA¶������,���vendor/symfony/console/Style/OutputStyle.php\��%‡D]\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��%‡D]Ï��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��%‡D]ä��­å (¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��%‡D]Ï��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��%‡D]ª��¬K z¶������(���vendor/symfony/debug/BufferingLogger.phpt��%‡D]t��=�hܶ���������vendor/symfony/debug/Debug.php,��%‡D],��Ë~Ž.¶������)���vendor/symfony/debug/DebugClassLoader.phpµ��%‡D]µ��1rEÓ¶������%���vendor/symfony/debug/ErrorHandler.phpH��%‡D]H��¹:D#¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��%‡D]–��i‰æô¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��%‡D]˜��-
  50. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��%‡D]��®+Ãê¶������6���vendor/symfony/debug/Exception/FatalErrorException.php��%‡D]��™Ä¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��%‡D]W��?àèK¶������3���vendor/symfony/debug/Exception/FlattenException.php¼��%‡D]¼�� ׶������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���%‡D]~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��%‡D]š���ñJÀ¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��%‡D]˜��nöêض������)���vendor/symfony/debug/ExceptionHandler.php)3��%‡D])3���h5=¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��%‡D]A��Ϥ¹l¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��%‡D]��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��%‡D]x��~ò"¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��%‡D]O���ž¦*¶���������vendor/symfony/debug/LICENSE)��%‡D])��NUN½¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���%‡D]i���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��%‡D]¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��%‡D]‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���%‡D]¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpc4��%‡D]c4��‹×@þ¶������!���vendor/symfony/filesystem/LICENSE)��%‡D])��NUN½¶������)���vendor/symfony/filesystem/LockHandler.phpö��%‡D]ö��ŸZµ1¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��%‡D]\ ��hˆB¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���%‡D]���HC€/¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��%‡D]›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��%‡D]3��75$·¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��%‡D]��Ÿ`]¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��%‡D]ô��Þdè;¶������/���vendor/symfony/finder/Comparator/Comparator.php���%‡D]���¾üœµ¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��%‡D]#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��%‡D]|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���%‡D]„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��%‡D]¬��wR¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���%‡D]„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��%‡D])��x§e¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��%‡D]º��˜þ˜¶������/���vendor/symfony/finder/Expression/Expression.php��%‡D]��i¥:Ŷ������)���vendor/symfony/finder/Expression/Glob.phpf��%‡D]f��DÞcj¶������*���vendor/symfony/finder/Expression/Regex.php��%‡D]��ü(Ã϶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��%‡D]Í��\p4†¶������ ���vendor/symfony/finder/Finder.phpc.��%‡D]c.��:ˆ5g¶���������vendor/symfony/finder/Glob.phpL��%‡D]L��jÍ9׶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��%‡D]]��ÎoÅƶ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��%‡D]x��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��%‡D]î��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��%‡D]í��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��%‡D]#��G?T½¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��%‡D]Z��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��%‡D]5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��%‡D]r��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��%‡D]Ã��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��%‡D]-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��%‡D]Ð��‚c¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��%‡D] ��ë]í»¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��%‡D]e��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php+��%‡D]+��õÝË ¶���������vendor/symfony/finder/LICENSE)��%‡D])��NUN½¶������'���vendor/symfony/finder/Shell/Command.php> ��%‡D]> ��_~u ¶������%���vendor/symfony/finder/Shell/Shell.phpr��%‡D]r��þpN¶������%���vendor/symfony/finder/SplFileInfo.php��%‡D]��þ�íù¶������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��%‡D]H ��³�Õݶ������%���vendor/symfony/polyfill-ctype/LICENSE)��%‡D])��´`e0¶������+���vendor/symfony/polyfill-ctype/bootstrap.phpI��%‡D]I���D!e¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��%‡D])��“\ª¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpC��%‡D]C��ãZ?¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��%‡D]÷@��õžØ¶������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��%‡D]ã��öy_•¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��%‡D]fA��Úf”߶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpË��%‡D]Ë��ó<Ë¢¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���%‡D]f���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���%‡D]¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���%‡D]”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��%‡D]x��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��%‡D]��﫶������5���vendor/symfony/process/Exception/RuntimeException.php˜���%‡D]˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php���%‡D]���ûus€¶���������vendor/symfony/process/LICENSE)��%‡D])��NUN½¶������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��%‡D]Ï��Î%h¶������%���vendor/symfony/process/PhpProcess.phpü��%‡D]ü��‡jûü¶������.���vendor/symfony/process/Pipes/AbstractPipes.php½��%‡D]½��憶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��%‡D]D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��%‡D]>��ª•ir¶������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��%‡D]p ��âU~ɶ������"���vendor/symfony/process/Process.php·R��%‡D]·R��Š`Õ¶������)���vendor/symfony/process/ProcessBuilder.phpâ
  51. ��%‡D]â
  52. ��†M¶¶������'���vendor/symfony/process/ProcessUtils.phpQ��%‡D]Q��b-$m¶���������vendor/seld/jsonlint/LICENSE"��%‡D]"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��%‡D]*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��%‡D]/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��%‡D]��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��%‡D]��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���%‡D]>���ÿqŸŸ¶������(���vendor/justinrainbow/json-schema/LICENSE ��%‡D] ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��%‡D]ñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��%‡D]¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  53. ��%‡D]�
  54. ��ÍèÓ¯¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��%‡D]§ ��›Vض������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��%‡D]¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��%‡D]]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��%‡D]ã ��á0;¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��%‡D]…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��%‡D]‡ ��ï›(¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��%‡D]Ã��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��%‡D]0 ��×j´˜¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��%‡D]��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��%‡D]a�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��%‡D]—��4~¾ ¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��%‡D]‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��%‡D]&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"��%‡D],"��ulÙ·¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��%‡D]è��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���%‡D]I���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���%‡D]•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���%‡D]l���A!L׶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���%‡D]l���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���%‡D]u���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���%‡D]w���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��%‡D]Þ��\¸
  55. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���%‡D]o���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���%‡D]…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���%‡D]€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���%‡D]j���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���%‡D]f���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��%‡D]þ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��%‡D] ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��%‡D]œ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��%‡D]��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���%‡D]á���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��%‡D]¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��%‡D]%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��%‡D],��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���%‡D]®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��%‡D] ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��%‡D]F��¨IaD¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���%‡D]ƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���%‡D]…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpx��%‡D]x��eÃþ¶������%���vendor/composer/spdx-licenses/LICENSE��%‡D]��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��%‡D]H��͉T¶���������vendor/composer/semver/LICENSE��%‡D]��Bhí¶������)���vendor/composer/semver/src/Comparator.php��%‡D]��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��%‡D]î��Õ­w-¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��%‡D]ª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���%‡D]ß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��%‡D]é��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��%‡D]1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��%‡D]v��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¯*��%‡D]¯*��ZÒ“¶������!���vendor/composer/ca-bundle/LICENSE��%‡D]��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php±��%‡D]±��à “¶������&���vendor/composer/xdebug-handler/LICENSE)��%‡D])��#Ô;^¶������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��%‡D]´��*D’�¶������.���vendor/composer/xdebug-handler/src/Process.php ��%‡D] ��`çîȶ������-���vendor/composer/xdebug-handler/src/Status.php
  56. ��%‡D]
  57. ��²‚²¶������4���vendor/composer/xdebug-handler/src/XdebugHandler.php!��%‡D]!��2|¿C¶���������vendor/psr/log/LICENSE=��%‡D]=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��%‡D];��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���%‡D]`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���%‡D]û���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���%‡D]|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���%‡D]§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��%‡D]Æ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��%‡D]i��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���%‡D]ž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpI ��%‡D]I ��õÇAs¶������*���vendor/psr/log/Psr/Log/Test/TestLogger.php ��%‡D] ��ôc�›¶���������vendor/autoload.php‚���%‡D]‚���xDŒØ¶������'���vendor/composer/autoload_namespaces.phpd���%‡D]d���Z¡¦H¶������!���vendor/composer/autoload_psr4.php÷��%‡D]÷��Å*š¶������%���vendor/composer/autoload_classmap.phpd���%‡D]d���Z¡¦H¶������"���vendor/composer/autoload_files.php��%‡D]��¥� ®¶������!���vendor/composer/autoload_real.phpI��%‡D]I��‚$W-¶������#���vendor/composer/autoload_static.php§
  58. ��%‡D]§
  59. ��»ê¸:¶���������vendor/composer/ClassLoader.php¨��%‡D]¨��xää`¶������(���vendor/composer/ca-bundle/res/cacert.pemDs�%‡D]Ds�\¢½‘¶������ ���bin/composerÊ��%‡D]Ê��ÿêP¶���������LICENSE.��%‡D].�� Õ¶������<?php
  60. namespace Composer\Autoload;
  61. use Composer\Config;
  62. use Composer\EventDispatcher\EventDispatcher;
  63. use Composer\Installer\InstallationManager;
  64. use Composer\IO\IOInterface;
  65. use Composer\Package\AliasPackage;
  66. use Composer\Package\PackageInterface;
  67. use Composer\Repository\InstalledRepositoryInterface;
  68. use Composer\Util\Filesystem;
  69. use Composer\Script\ScriptEvents;
  70. use Composer\Util\PackageSorter;
  71. class AutoloadGenerator
  72. {
  73. private $eventDispatcher;
  74. private $io;
  75. private $devMode = false;
  76. private $classMapAuthoritative = false;
  77. private $apcu = false;
  78. private $runScripts = false;
  79. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  80. {
  81. $this->eventDispatcher = $eventDispatcher;
  82. $this->io = $io;
  83. }
  84. public function setDevMode($devMode = true)
  85. {
  86. $this->devMode = (bool) $devMode;
  87. }
  88. public function setClassMapAuthoritative($classMapAuthoritative)
  89. {
  90. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  91. }
  92. public function setApcu($apcu)
  93. {
  94. $this->apcu = (bool) $apcu;
  95. }
  96. public function setRunScripts($runScripts = true)
  97. {
  98. $this->runScripts = (bool) $runScripts;
  99. }
  100. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  101. {
  102. if ($this->classMapAuthoritative) {
  103. $scanPsr0Packages = true;
  104. }
  105. if ($this->runScripts) {
  106. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  107. 'optimize' => (bool) $scanPsr0Packages,
  108. ));
  109. }
  110. $filesystem = new Filesystem();
  111. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  112. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  113. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  114. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  115. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  116. $targetDir = $vendorPath.'/'.$targetDir;
  117. $filesystem->ensureDirectoryExists($targetDir);
  118. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  119. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  120. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  121. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  122. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  123. $namespacesFile = <<<EOF
  124. <?php
  125. // autoload_namespaces.php @generated by Composer
  126. \$vendorDir = $vendorPathCode52;
  127. \$baseDir = $appBaseDirCode;
  128. return array(
  129. EOF;
  130. $psr4File = <<<EOF
  131. <?php
  132. // autoload_psr4.php @generated by Composer
  133. \$vendorDir = $vendorPathCode52;
  134. \$baseDir = $appBaseDirCode;
  135. return array(
  136. EOF;
  137. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  138. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  139. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  140. $exportedPaths = array();
  141. foreach ($paths as $path) {
  142. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  143. }
  144. $exportedPrefix = var_export($namespace, true);
  145. $namespacesFile .= " $exportedPrefix => ";
  146. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  147. }
  148. $namespacesFile .= ");\n";
  149. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  150. $exportedPaths = array();
  151. foreach ($paths as $path) {
  152. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  153. }
  154. $exportedPrefix = var_export($namespace, true);
  155. $psr4File .= " $exportedPrefix => ";
  156. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  157. }
  158. $psr4File .= ");\n";
  159. $classmapFile = <<<EOF
  160. <?php
  161. // autoload_classmap.php @generated by Composer
  162. \$vendorDir = $vendorPathCode52;
  163. \$baseDir = $appBaseDirCode;
  164. return array(
  165. EOF;
  166. $targetDirLoader = null;
  167. $mainAutoload = $mainPackage->getAutoload();
  168. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  169. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  170. $prefixes = implode(', ', array_map(function ($prefix) {
  171. return var_export($prefix, true);
  172. }, array_keys($mainAutoload['psr-0'])));
  173. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  174. $targetDirLoader = <<<EOF
  175. public static function autoload(\$class)
  176. {
  177. \$dir = $baseDirFromTargetDirCode . '/';
  178. \$prefixes = array($prefixes);
  179. foreach (\$prefixes as \$prefix) {
  180. if (0 !== strpos(\$class, \$prefix)) {
  181. continue;
  182. }
  183. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  184. if (!\$path = stream_resolve_include_path(\$path)) {
  185. return false;
  186. }
  187. require \$path;
  188. return true;
  189. }
  190. }
  191. EOF;
  192. }
  193. $blacklist = null;
  194. if (!empty($autoloads['exclude-from-classmap'])) {
  195. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  196. }
  197. $classMap = array();
  198. if ($scanPsr0Packages) {
  199. $namespacesToScan = array();
  200. foreach (array('psr-0', 'psr-4') as $psrType) {
  201. foreach ($autoloads[$psrType] as $namespace => $paths) {
  202. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  203. }
  204. }
  205. krsort($namespacesToScan);
  206. foreach ($namespacesToScan as $namespace => $groups) {
  207. foreach ($groups as $group) {
  208. foreach ($group['paths'] as $dir) {
  209. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  210. if (!is_dir($dir)) {
  211. continue;
  212. }
  213. $namespaceFilter = $namespace === '' ? null : $namespace;
  214. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  215. }
  216. }
  217. }
  218. }
  219. foreach ($autoloads['classmap'] as $dir) {
  220. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  221. }
  222. ksort($classMap);
  223. foreach ($classMap as $class => $code) {
  224. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  225. }
  226. $classmapFile .= ");\n";
  227. if (!$suffix) {
  228. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  229. $content = file_get_contents($vendorPath.'/autoload.php');
  230. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  231. $suffix = $match[1];
  232. }
  233. }
  234. if (!$suffix) {
  235. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  236. }
  237. }
  238. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  239. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  240. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  241. $includePathFilePath = $targetDir.'/include_paths.php';
  242. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  243. file_put_contents($includePathFilePath, $includePathFileContents);
  244. } elseif (file_exists($includePathFilePath)) {
  245. unlink($includePathFilePath);
  246. }
  247. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  248. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  249. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  250. } elseif (file_exists($includeFilesFilePath)) {
  251. unlink($includeFilesFilePath);
  252. }
  253. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  254. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  255. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  256. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  257. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  258. if ($this->runScripts) {
  259. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  260. 'optimize' => (bool) $scanPsr0Packages,
  261. ));
  262. }
  263. return count($classMap);
  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, $filterOutRequireDevPackages = false)
  316. {
  317. $mainPackageMap = array_shift($packageMap);
  318. if ($filterOutRequireDevPackages) {
  319. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  320. }
  321. $sortedPackageMap = $this->sortPackageMap($packageMap);
  322. $sortedPackageMap[] = $mainPackageMap;
  323. array_unshift($packageMap, $mainPackageMap);
  324. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  325. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  326. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  327. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  328. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  329. krsort($psr0);
  330. krsort($psr4);
  331. return array(
  332. 'psr-0' => $psr0,
  333. 'psr-4' => $psr4,
  334. 'classmap' => $classmap,
  335. 'files' => $files,
  336. 'exclude-from-classmap' => $exclude,
  337. );
  338. }
  339. public function createLoader(array $autoloads)
  340. {
  341. $loader = new ClassLoader();
  342. if (isset($autoloads['psr-0'])) {
  343. foreach ($autoloads['psr-0'] as $namespace => $path) {
  344. $loader->add($namespace, $path);
  345. }
  346. }
  347. if (isset($autoloads['psr-4'])) {
  348. foreach ($autoloads['psr-4'] as $namespace => $path) {
  349. $loader->addPsr4($namespace, $path);
  350. }
  351. }
  352. if (isset($autoloads['classmap'])) {
  353. $blacklist = null;
  354. if (!empty($autoloads['exclude-from-classmap'])) {
  355. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  356. }
  357. foreach ($autoloads['classmap'] as $dir) {
  358. try {
  359. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  360. } catch (\RuntimeException $e) {
  361. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  362. }
  363. }
  364. }
  365. return $loader;
  366. }
  367. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  368. {
  369. $includePaths = array();
  370. foreach ($packageMap as $item) {
  371. list($package, $installPath) = $item;
  372. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  373. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  374. }
  375. foreach ($package->getIncludePaths() as $includePath) {
  376. $includePath = trim($includePath, '/');
  377. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  378. }
  379. }
  380. if (!$includePaths) {
  381. return;
  382. }
  383. $includePathsCode = '';
  384. foreach ($includePaths as $path) {
  385. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  386. }
  387. return <<<EOF
  388. <?php
  389. // include_paths.php @generated by Composer
  390. \$vendorDir = $vendorPathCode;
  391. \$baseDir = $appBaseDirCode;
  392. return array(
  393. $includePathsCode);
  394. EOF;
  395. }
  396. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  397. {
  398. $filesCode = '';
  399. foreach ($files as $fileIdentifier => $functionFile) {
  400. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  401. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  402. }
  403. if (!$filesCode) {
  404. return false;
  405. }
  406. return <<<EOF
  407. <?php
  408. // autoload_files.php @generated by Composer
  409. \$vendorDir = $vendorPathCode;
  410. \$baseDir = $appBaseDirCode;
  411. return array(
  412. $filesCode);
  413. EOF;
  414. }
  415. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  416. {
  417. if (!$filesystem->isAbsolutePath($path)) {
  418. $path = $basePath . '/' . $path;
  419. }
  420. $path = $filesystem->normalizePath($path);
  421. $baseDir = '';
  422. if (strpos($path.'/', $vendorPath.'/') === 0) {
  423. $path = substr($path, strlen($vendorPath));
  424. $baseDir = '$vendorDir';
  425. if ($path !== false) {
  426. $baseDir .= " . ";
  427. }
  428. } else {
  429. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  430. if (!$filesystem->isAbsolutePath($path)) {
  431. $baseDir = '$baseDir . ';
  432. $path = '/' . $path;
  433. }
  434. }
  435. if (strpos($path, '.phar') !== false) {
  436. $baseDir = "'phar://' . " . $baseDir;
  437. }
  438. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  439. }
  440. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  441. {
  442. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  443. if ("'" === $lastChar || '"' === $lastChar) {
  444. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  445. } else {
  446. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  447. }
  448. return <<<AUTOLOAD
  449. <?php
  450. // autoload.php @generated by Composer
  451. require_once $vendorPathToTargetDirCode;
  452. return ComposerAutoloaderInit$suffix::getLoader();
  453. AUTOLOAD;
  454. }
  455. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  456. {
  457. $file = <<<HEADER
  458. <?php
  459. // autoload_real.php @generated by Composer
  460. class ComposerAutoloaderInit$suffix
  461. {
  462. private static \$loader;
  463. public static function loadClassLoader(\$class)
  464. {
  465. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  466. require __DIR__ . '/ClassLoader.php';
  467. }
  468. }
  469. public static function getLoader()
  470. {
  471. if (null !== self::\$loader) {
  472. return self::\$loader;
  473. }
  474. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  475. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  476. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  477. HEADER;
  478. if ($useIncludePath) {
  479. $file .= <<<'INCLUDE_PATH'
  480. $includePaths = require __DIR__ . '/include_paths.php';
  481. $includePaths[] = get_include_path();
  482. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  483. INCLUDE_PATH;
  484. }
  485. $file .= <<<STATIC_INIT
  486. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  487. if (\$useStaticLoader) {
  488. require_once __DIR__ . '/autoload_static.php';
  489. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  490. } else {
  491. STATIC_INIT;
  492. if (!$this->classMapAuthoritative) {
  493. $file .= <<<'PSR04'
  494. $map = require __DIR__ . '/autoload_namespaces.php';
  495. foreach ($map as $namespace => $path) {
  496. $loader->set($namespace, $path);
  497. }
  498. $map = require __DIR__ . '/autoload_psr4.php';
  499. foreach ($map as $namespace => $path) {
  500. $loader->setPsr4($namespace, $path);
  501. }
  502. PSR04;
  503. }
  504. if ($useClassMap) {
  505. $file .= <<<'CLASSMAP'
  506. $classMap = require __DIR__ . '/autoload_classmap.php';
  507. if ($classMap) {
  508. $loader->addClassMap($classMap);
  509. }
  510. CLASSMAP;
  511. }
  512. $file .= " }\n\n";
  513. if ($this->classMapAuthoritative) {
  514. $file .= <<<'CLASSMAPAUTHORITATIVE'
  515. $loader->setClassMapAuthoritative(true);
  516. CLASSMAPAUTHORITATIVE;
  517. }
  518. if ($this->apcu) {
  519. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  520. $file .= <<<APCU
  521. \$loader->setApcuPrefix('$apcuPrefix');
  522. APCU;
  523. }
  524. if ($useGlobalIncludePath) {
  525. $file .= <<<'INCLUDEPATH'
  526. $loader->setUseIncludePath(true);
  527. INCLUDEPATH;
  528. }
  529. if ($targetDirLoader) {
  530. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  531. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  532. REGISTER_TARGET_DIR_AUTOLOAD;
  533. }
  534. $file .= <<<REGISTER_LOADER
  535. \$loader->register($prependAutoloader);
  536. REGISTER_LOADER;
  537. if ($useIncludeFiles) {
  538. $file .= <<<INCLUDE_FILES
  539. if (\$useStaticLoader) {
  540. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  541. } else {
  542. \$includeFiles = require __DIR__ . '/autoload_files.php';
  543. }
  544. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  545. composerRequire$suffix(\$fileIdentifier, \$file);
  546. }
  547. INCLUDE_FILES;
  548. }
  549. $file .= <<<METHOD_FOOTER
  550. return \$loader;
  551. }
  552. METHOD_FOOTER;
  553. $file .= $targetDirLoader;
  554. if ($useIncludeFiles) {
  555. return $file . <<<FOOTER
  556. }
  557. function composerRequire$suffix(\$fileIdentifier, \$file)
  558. {
  559. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  560. require \$file;
  561. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  562. }
  563. }
  564. FOOTER;
  565. }
  566. return $file . <<<FOOTER
  567. }
  568. FOOTER;
  569. }
  570. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  571. {
  572. $staticPhpVersion = 50600;
  573. $file = <<<HEADER
  574. <?php
  575. // autoload_static.php @generated by Composer
  576. namespace Composer\Autoload;
  577. class ComposerStaticInit$suffix
  578. {
  579. HEADER;
  580. $loader = new ClassLoader();
  581. $map = require $targetDir . '/autoload_namespaces.php';
  582. foreach ($map as $namespace => $path) {
  583. $loader->set($namespace, $path);
  584. }
  585. $map = require $targetDir . '/autoload_psr4.php';
  586. foreach ($map as $namespace => $path) {
  587. $loader->setPsr4($namespace, $path);
  588. }
  589. $classMap = require $targetDir . '/autoload_classmap.php';
  590. if ($classMap) {
  591. $loader->addClassMap($classMap);
  592. }
  593. $filesystem = new Filesystem();
  594. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  595. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  596. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  597. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  598. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  599. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  600. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  601. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  602. $initializer = '';
  603. $prefix = "\0Composer\Autoload\ClassLoader\0";
  604. $prefixLen = strlen($prefix);
  605. if (file_exists($targetDir . '/autoload_files.php')) {
  606. $maps = array('files' => require $targetDir . '/autoload_files.php');
  607. } else {
  608. $maps = array();
  609. }
  610. foreach ((array) $loader as $prop => $value) {
  611. if ($value && 0 === strpos($prop, $prefix)) {
  612. $maps[substr($prop, $prefixLen)] = $value;
  613. }
  614. }
  615. foreach ($maps as $prop => $value) {
  616. if (count($value) > 32767) {
  617. $staticPhpVersion = 70000;
  618. }
  619. $value = strtr(
  620. var_export($value, true),
  621. array(
  622. $absoluteVendorPathCode => $vendorPathCode,
  623. $absoluteVendorPharPathCode => $vendorPharPathCode,
  624. $absoluteAppBaseDirCode => $appBaseDirCode,
  625. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  626. )
  627. );
  628. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  629. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  630. if ('files' !== $prop) {
  631. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  632. }
  633. }
  634. return $file . <<<INITIALIZER
  635. public static function getInitializer(ClassLoader \$loader)
  636. {
  637. return \Closure::bind(function () use (\$loader) {
  638. $initializer
  639. }, null, ClassLoader::class);
  640. }
  641. }
  642. INITIALIZER;
  643. }
  644. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  645. {
  646. $autoloads = array();
  647. foreach ($packageMap as $item) {
  648. list($package, $installPath) = $item;
  649. $autoload = $package->getAutoload();
  650. if ($this->devMode && $package === $mainPackage) {
  651. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  652. }
  653. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  654. continue;
  655. }
  656. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  657. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  658. }
  659. foreach ($autoload[$type] as $namespace => $paths) {
  660. foreach ((array) $paths as $path) {
  661. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  662. if ($package === $mainPackage) {
  663. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  664. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  665. } else {
  666. $path = $package->getTargetDir() . '/' . $path;
  667. }
  668. }
  669. if ($type === 'exclude-from-classmap') {
  670. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  671. $path = str_replace('\\*\\*', '.+?', $path);
  672. $path = str_replace('\\*', '[^/]+?', $path);
  673. $updir = null;
  674. $path = preg_replace_callback(
  675. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  676. function ($matches) use (&$updir) {
  677. if (isset($matches[1])) {
  678. $updir = str_replace('\\.', '.', $matches[1]);
  679. }
  680. return '';
  681. },
  682. $path
  683. );
  684. if (empty($installPath)) {
  685. $installPath = strtr(getcwd(), '\\', '/');
  686. }
  687. $resolvedPath = realpath($installPath . '/' . $updir);
  688. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  689. continue;
  690. }
  691. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  692. if ($type === 'files') {
  693. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  694. continue;
  695. } elseif ($type === 'classmap') {
  696. $autoloads[] = $relativePath;
  697. continue;
  698. }
  699. $autoloads[$namespace][] = $relativePath;
  700. }
  701. }
  702. }
  703. return $autoloads;
  704. }
  705. protected function getFileIdentifier(PackageInterface $package, $path)
  706. {
  707. return md5($package->getName() . ':' . $path);
  708. }
  709. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  710. {
  711. $packages = array();
  712. $include = array();
  713. foreach ($packageMap as $item) {
  714. $package = $item[0];
  715. $name = $package->getName();
  716. $packages[$name] = $package;
  717. }
  718. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  719. foreach ($package->getRequires() as $link) {
  720. $target = $link->getTarget();
  721. if (!isset($include[$target])) {
  722. $include[$target] = true;
  723. if (isset($packages[$target])) {
  724. $add($packages[$target]);
  725. }
  726. }
  727. }
  728. };
  729. $add($mainPackage);
  730. return array_filter(
  731. $packageMap,
  732. function ($item) use ($include) {
  733. $package = $item[0];
  734. foreach ($package->getNames() as $name) {
  735. if (isset($include[$name])) {
  736. return true;
  737. }
  738. }
  739. return false;
  740. }
  741. );
  742. }
  743. protected function sortPackageMap(array $packageMap)
  744. {
  745. $packages = array();
  746. $paths = array();
  747. foreach ($packageMap as $item) {
  748. list($package, $path) = $item;
  749. $name = $package->getName();
  750. $packages[$name] = $package;
  751. $paths[$name] = $path;
  752. }
  753. $sortedPackages = PackageSorter::sortPackages($packages);
  754. $sortedPackageMap = array();
  755. foreach ($sortedPackages as $package) {
  756. $name = $package->getName();
  757. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  758. }
  759. return $sortedPackageMap;
  760. }
  761. protected function safeCopy($source, $target)
  762. {
  763. $source = fopen($source, 'r');
  764. $target = fopen($target, 'w+');
  765. stream_copy_to_stream($source, $target);
  766. fclose($source);
  767. fclose($target);
  768. }
  769. }
  770. <?php
  771. namespace Composer\Autoload;
  772. use Symfony\Component\Finder\Finder;
  773. use Composer\IO\IOInterface;
  774. use Composer\Util\Filesystem;
  775. class ClassMapGenerator
  776. {
  777. public static function dump($dirs, $file)
  778. {
  779. $maps = array();
  780. foreach ($dirs as $dir) {
  781. $maps = array_merge($maps, static::createMap($dir));
  782. }
  783. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  784. }
  785. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  786. {
  787. if (is_string($path)) {
  788. if (is_file($path)) {
  789. $path = array(new \SplFileInfo($path));
  790. } elseif (is_dir($path)) {
  791. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  792. } else {
  793. throw new \RuntimeException(
  794. 'Could not scan for classes inside "'.$path.
  795. '" which does not appear to be a file nor a folder'
  796. );
  797. }
  798. }
  799. $map = array();
  800. $filesystem = new Filesystem();
  801. $cwd = realpath(getcwd());
  802. foreach ($path as $file) {
  803. $filePath = $file->getPathname();
  804. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  805. continue;
  806. }
  807. if (!$filesystem->isAbsolutePath($filePath)) {
  808. $filePath = $cwd . '/' . $filePath;
  809. $filePath = $filesystem->normalizePath($filePath);
  810. } else {
  811. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  812. }
  813. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  814. continue;
  815. }
  816. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  817. continue;
  818. }
  819. $classes = self::findClasses($filePath);
  820. foreach ($classes as $class) {
  821. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  822. continue;
  823. }
  824. if (!isset($map[$class])) {
  825. $map[$class] = $filePath;
  826. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  827. $io->writeError(
  828. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  829. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  830. );
  831. }
  832. }
  833. }
  834. return $map;
  835. }
  836. private static function findClasses($path)
  837. {
  838. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  839. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  840. $extraTypes .= '|enum';
  841. }
  842. $contents = @php_strip_whitespace($path);
  843. if (!$contents) {
  844. if (!file_exists($path)) {
  845. $message = 'File at "%s" does not exist, check your classmap definitions';
  846. } elseif (!is_readable($path)) {
  847. $message = 'File at "%s" is not readable, check its permissions';
  848. } elseif ('' === trim(file_get_contents($path))) {
  849. return array();
  850. } else {
  851. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  852. }
  853. $error = error_get_last();
  854. if (isset($error['message'])) {
  855. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  856. }
  857. throw new \RuntimeException(sprintf($message, $path));
  858. }
  859. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  860. return array();
  861. }
  862. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  863. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  864. if (substr($contents, 0, 2) !== '<?') {
  865. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  866. if ($replacements === 0) {
  867. return array();
  868. }
  869. }
  870. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  871. $pos = strrpos($contents, '?>');
  872. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  873. $contents = substr($contents, 0, $pos);
  874. }
  875. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  876. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  877. }
  878. preg_match_all('{
  879. (?:
  880. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  881. | \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*+ [\{;]
  882. )
  883. }ix', $contents, $matches);
  884. $classes = array();
  885. $namespace = '';
  886. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  887. if (!empty($matches['ns'][$i])) {
  888. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  889. } else {
  890. $name = $matches['name'][$i];
  891. if ($name === 'extends' || $name === 'implements') {
  892. continue;
  893. }
  894. if ($name[0] === ':') {
  895. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  896. } elseif ($matches['type'][$i] === 'enum') {
  897. $name = rtrim($name, ':');
  898. }
  899. $classes[] = ltrim($namespace . $name, '\\');
  900. }
  901. }
  902. return $classes;
  903. }
  904. }
  905. <?php
  906. namespace Composer;
  907. use Composer\IO\IOInterface;
  908. use Composer\Util\Filesystem;
  909. use Composer\Util\Silencer;
  910. use Symfony\Component\Finder\Finder;
  911. class Cache
  912. {
  913. private static $cacheCollected = false;
  914. private $io;
  915. private $root;
  916. private $enabled = true;
  917. private $whitelist;
  918. private $filesystem;
  919. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  920. {
  921. $this->io = $io;
  922. $this->root = rtrim($cacheDir, '/\\') . '/';
  923. $this->whitelist = $whitelist;
  924. $this->filesystem = $filesystem ?: new Filesystem();
  925. if (!self::isUsable($cacheDir)) {
  926. $this->enabled = false;
  927. return;
  928. }
  929. if (
  930. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  931. || !is_writable($this->root)
  932. ) {
  933. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  934. $this->enabled = false;
  935. }
  936. }
  937. public static function isUsable($path)
  938. {
  939. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  940. }
  941. public function isEnabled()
  942. {
  943. return $this->enabled;
  944. }
  945. public function getRoot()
  946. {
  947. return $this->root;
  948. }
  949. public function read($file)
  950. {
  951. if ($this->enabled) {
  952. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  953. if (file_exists($this->root . $file)) {
  954. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  955. return file_get_contents($this->root . $file);
  956. }
  957. }
  958. return false;
  959. }
  960. public function write($file, $contents)
  961. {
  962. if ($this->enabled) {
  963. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  964. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  965. try {
  966. return file_put_contents($this->root . $file, $contents);
  967. } catch (\ErrorException $e) {
  968. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  969. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  970. unlink($this->root . $file);
  971. $message = sprintf(
  972. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  973. $this->root . $file,
  974. $m[1],
  975. $m[2],
  976. @disk_free_space($this->root . dirname($file))
  977. );
  978. $this->io->writeError($message);
  979. return false;
  980. }
  981. throw $e;
  982. }
  983. }
  984. return false;
  985. }
  986. public function copyFrom($file, $source)
  987. {
  988. if ($this->enabled) {
  989. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  990. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  991. if (!file_exists($source)) {
  992. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  993. } elseif ($this->io->isDebug()) {
  994. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  995. }
  996. return copy($source, $this->root . $file);
  997. }
  998. return false;
  999. }
  1000. public function copyTo($file, $target)
  1001. {
  1002. if ($this->enabled) {
  1003. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1004. if (file_exists($this->root . $file)) {
  1005. try {
  1006. touch($this->root . $file, filemtime($this->root . $file), time());
  1007. } catch (\ErrorException $e) {
  1008. Silencer::call('touch', $this->root . $file);
  1009. }
  1010. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1011. return copy($this->root . $file, $target);
  1012. }
  1013. }
  1014. return false;
  1015. }
  1016. public function gcIsNecessary()
  1017. {
  1018. return (!self::$cacheCollected && !mt_rand(0, 50));
  1019. }
  1020. public function remove($file)
  1021. {
  1022. if ($this->enabled) {
  1023. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1024. if (file_exists($this->root . $file)) {
  1025. return $this->filesystem->unlink($this->root . $file);
  1026. }
  1027. }
  1028. return false;
  1029. }
  1030. public function clear()
  1031. {
  1032. if ($this->enabled) {
  1033. $this->filesystem->emptyDirectory($this->root);
  1034. return true;
  1035. }
  1036. return false;
  1037. }
  1038. public function gc($ttl, $maxSize)
  1039. {
  1040. if ($this->enabled) {
  1041. $expire = new \DateTime();
  1042. $expire->modify('-'.$ttl.' seconds');
  1043. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1044. foreach ($finder as $file) {
  1045. $this->filesystem->unlink($file->getPathname());
  1046. }
  1047. $totalSize = $this->filesystem->size($this->root);
  1048. if ($totalSize > $maxSize) {
  1049. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1050. while ($totalSize > $maxSize && $iterator->valid()) {
  1051. $filepath = $iterator->current()->getPathname();
  1052. $totalSize -= $this->filesystem->size($filepath);
  1053. $this->filesystem->unlink($filepath);
  1054. $iterator->next();
  1055. }
  1056. }
  1057. self::$cacheCollected = true;
  1058. return true;
  1059. }
  1060. return false;
  1061. }
  1062. public function sha1($file)
  1063. {
  1064. if ($this->enabled) {
  1065. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1066. if (file_exists($this->root . $file)) {
  1067. return sha1_file($this->root . $file);
  1068. }
  1069. }
  1070. return false;
  1071. }
  1072. public function sha256($file)
  1073. {
  1074. if ($this->enabled) {
  1075. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1076. if (file_exists($this->root . $file)) {
  1077. return hash_file('sha256', $this->root . $file);
  1078. }
  1079. }
  1080. return false;
  1081. }
  1082. protected function getFinder()
  1083. {
  1084. return Finder::create()->in($this->root)->files();
  1085. }
  1086. }
  1087. <?php
  1088. namespace Composer\Command;
  1089. use Symfony\Component\Console\Input\InputInterface;
  1090. use Symfony\Component\Console\Output\OutputInterface;
  1091. class AboutCommand extends BaseCommand
  1092. {
  1093. protected function configure()
  1094. {
  1095. $this
  1096. ->setName('about')
  1097. ->setDescription('Shows the short information about Composer.')
  1098. ->setHelp(
  1099. <<<EOT
  1100. <info>php composer.phar about</info>
  1101. EOT
  1102. )
  1103. ;
  1104. }
  1105. protected function execute(InputInterface $input, OutputInterface $output)
  1106. {
  1107. $this->getIO()->write(
  1108. <<<EOT
  1109. <info>Composer - Dependency Manager for PHP</info>
  1110. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1111. See https://getcomposer.org/ for more information.</comment>
  1112. EOT
  1113. );
  1114. }
  1115. }
  1116. <?php
  1117. namespace Composer\Command;
  1118. use Composer\Factory;
  1119. use Composer\IO\IOInterface;
  1120. use Composer\Config;
  1121. use Composer\Composer;
  1122. use Composer\Repository\CompositeRepository;
  1123. use Composer\Repository\RepositoryFactory;
  1124. use Composer\Script\ScriptEvents;
  1125. use Composer\Plugin\CommandEvent;
  1126. use Composer\Plugin\PluginEvents;
  1127. use Composer\Util\Filesystem;
  1128. use Symfony\Component\Console\Input\InputArgument;
  1129. use Symfony\Component\Console\Input\InputInterface;
  1130. use Symfony\Component\Console\Input\InputOption;
  1131. use Symfony\Component\Console\Output\OutputInterface;
  1132. class ArchiveCommand extends BaseCommand
  1133. {
  1134. protected function configure()
  1135. {
  1136. $this
  1137. ->setName('archive')
  1138. ->setDescription('Creates an archive of this composer package.')
  1139. ->setDefinition(array(
  1140. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1141. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1142. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1143. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1144. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1145. .' Note that the format will be appended.'),
  1146. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1147. ))
  1148. ->setHelp(
  1149. <<<EOT
  1150. The <info>archive</info> command creates an archive of the specified format
  1151. containing the files and directories of the Composer project or the specified
  1152. package in the specified version and writes it to the specified directory.
  1153. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1154. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1155. EOT
  1156. )
  1157. ;
  1158. }
  1159. protected function execute(InputInterface $input, OutputInterface $output)
  1160. {
  1161. $config = Factory::createConfig();
  1162. $composer = $this->getComposer(false);
  1163. if ($composer) {
  1164. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1165. $eventDispatcher = $composer->getEventDispatcher();
  1166. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1167. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1168. }
  1169. if (null === $input->getOption('format')) {
  1170. $input->setOption('format', $config->get('archive-format'));
  1171. }
  1172. if (null === $input->getOption('dir')) {
  1173. $input->setOption('dir', $config->get('archive-dir'));
  1174. }
  1175. $returnCode = $this->archive(
  1176. $this->getIO(),
  1177. $config,
  1178. $input->getArgument('package'),
  1179. $input->getArgument('version'),
  1180. $input->getOption('format'),
  1181. $input->getOption('dir'),
  1182. $input->getOption('file'),
  1183. $input->getOption('ignore-filters'),
  1184. $composer
  1185. );
  1186. if (0 === $returnCode && $composer) {
  1187. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1188. }
  1189. return $returnCode;
  1190. }
  1191. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1192. {
  1193. if ($composer) {
  1194. $archiveManager = $composer->getArchiveManager();
  1195. } else {
  1196. $factory = new Factory;
  1197. $downloadManager = $factory->createDownloadManager($io, $config);
  1198. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1199. }
  1200. if ($packageName) {
  1201. $package = $this->selectPackage($io, $packageName, $version);
  1202. if (!$package) {
  1203. return 1;
  1204. }
  1205. } else {
  1206. $package = $this->getComposer()->getPackage();
  1207. }
  1208. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1209. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1210. $fs = new Filesystem;
  1211. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1212. $io->writeError('Created: ', false);
  1213. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1214. return 0;
  1215. }
  1216. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1217. {
  1218. $io->writeError('<info>Searching for the specified package.</info>');
  1219. if ($composer = $this->getComposer(false)) {
  1220. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1221. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1222. } else {
  1223. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1224. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1225. $repo = new CompositeRepository($defaultRepos);
  1226. }
  1227. $packages = $repo->findPackages($packageName, $version);
  1228. if (count($packages) > 1) {
  1229. $package = reset($packages);
  1230. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1231. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1232. return $p->getPrettyString();
  1233. }, $packages)).'.');
  1234. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1235. } elseif ($packages) {
  1236. $package = reset($packages);
  1237. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1238. } else {
  1239. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1240. return false;
  1241. }
  1242. return $package;
  1243. }
  1244. }
  1245. <?php
  1246. namespace Composer\Command;
  1247. use Composer\Composer;
  1248. use Composer\Config;
  1249. use Composer\Console\Application;
  1250. use Composer\Factory;
  1251. use Composer\IO\IOInterface;
  1252. use Composer\IO\NullIO;
  1253. use Composer\Plugin\PreCommandRunEvent;
  1254. use Composer\Plugin\PluginEvents;
  1255. use Symfony\Component\Console\Input\InputInterface;
  1256. use Symfony\Component\Console\Output\OutputInterface;
  1257. use Symfony\Component\Console\Command\Command;
  1258. abstract class BaseCommand extends Command
  1259. {
  1260. private $composer;
  1261. private $io;
  1262. public function getComposer($required = true, $disablePlugins = null)
  1263. {
  1264. if (null === $this->composer) {
  1265. $application = $this->getApplication();
  1266. if ($application instanceof Application) {
  1267. $this->composer = $application->getComposer($required, $disablePlugins);
  1268. } elseif ($required) {
  1269. throw new \RuntimeException(
  1270. 'Could not create a Composer\Composer instance, you must inject '.
  1271. 'one if this command is not used with a Composer\Console\Application instance'
  1272. );
  1273. }
  1274. }
  1275. return $this->composer;
  1276. }
  1277. public function setComposer(Composer $composer)
  1278. {
  1279. $this->composer = $composer;
  1280. }
  1281. public function resetComposer()
  1282. {
  1283. $this->composer = null;
  1284. $this->getApplication()->resetComposer();
  1285. }
  1286. public function isProxyCommand()
  1287. {
  1288. return false;
  1289. }
  1290. public function getIO()
  1291. {
  1292. if (null === $this->io) {
  1293. $application = $this->getApplication();
  1294. if ($application instanceof Application) {
  1295. $this->io = $application->getIO();
  1296. } else {
  1297. $this->io = new NullIO();
  1298. }
  1299. }
  1300. return $this->io;
  1301. }
  1302. public function setIO(IOInterface $io)
  1303. {
  1304. $this->io = $io;
  1305. }
  1306. protected function initialize(InputInterface $input, OutputInterface $output)
  1307. {
  1308. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1309. $composer = $this->getComposer(false, $disablePlugins);
  1310. if (null === $composer) {
  1311. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1312. }
  1313. if ($composer) {
  1314. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1315. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1316. }
  1317. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1318. $input->setOption('no-progress', true);
  1319. }
  1320. parent::initialize($input, $output);
  1321. }
  1322. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1323. {
  1324. $preferSource = false;
  1325. $preferDist = false;
  1326. switch ($config->get('preferred-install')) {
  1327. case 'source':
  1328. $preferSource = true;
  1329. break;
  1330. case 'dist':
  1331. $preferDist = true;
  1332. break;
  1333. case 'auto':
  1334. default:
  1335. break;
  1336. }
  1337. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1338. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1339. $preferDist = $input->getOption('prefer-dist');
  1340. }
  1341. return array($preferSource, $preferDist);
  1342. }
  1343. }
  1344. <?php
  1345. namespace Composer\Command;
  1346. use Composer\DependencyResolver\Pool;
  1347. use Composer\Package\Link;
  1348. use Composer\Package\PackageInterface;
  1349. use Composer\Repository\ArrayRepository;
  1350. use Composer\Repository\CompositeRepository;
  1351. use Composer\Repository\PlatformRepository;
  1352. use Composer\Repository\RepositoryFactory;
  1353. use Composer\Plugin\CommandEvent;
  1354. use Composer\Plugin\PluginEvents;
  1355. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1356. use Composer\Package\Version\VersionParser;
  1357. use Symfony\Component\Console\Helper\Table;
  1358. use Symfony\Component\Console\Input\InputArgument;
  1359. use Symfony\Component\Console\Input\InputInterface;
  1360. use Symfony\Component\Console\Input\InputOption;
  1361. use Symfony\Component\Console\Output\OutputInterface;
  1362. class BaseDependencyCommand extends BaseCommand
  1363. {
  1364. const ARGUMENT_PACKAGE = 'package';
  1365. const ARGUMENT_CONSTRAINT = 'constraint';
  1366. const OPTION_RECURSIVE = 'recursive';
  1367. const OPTION_TREE = 'tree';
  1368. protected $colors;
  1369. protected function configure()
  1370. {
  1371. $this->setDefinition(array(
  1372. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1373. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1374. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1375. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1376. ));
  1377. }
  1378. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1379. {
  1380. $composer = $this->getComposer();
  1381. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1382. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1383. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1384. $repository = new CompositeRepository(array(
  1385. new ArrayRepository(array($composer->getPackage())),
  1386. $composer->getRepositoryManager()->getLocalRepository(),
  1387. new PlatformRepository(array(), $platformOverrides),
  1388. ));
  1389. $pool = new Pool();
  1390. $pool->addRepository($repository);
  1391. list($needle, $textConstraint) = array_pad(
  1392. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1393. 2,
  1394. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1395. );
  1396. $packages = $pool->whatProvides(strtolower($needle));
  1397. if (empty($packages)) {
  1398. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1399. }
  1400. if (!$repository->findPackage($needle, $textConstraint)) {
  1401. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1402. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1403. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1404. }
  1405. }
  1406. $needles = array($needle);
  1407. if ($inverted) {
  1408. foreach ($packages as $package) {
  1409. $needles = array_merge($needles, array_map(function (Link $link) {
  1410. return $link->getTarget();
  1411. }, $package->getReplaces()));
  1412. }
  1413. }
  1414. if ('*' !== $textConstraint) {
  1415. $versionParser = new VersionParser();
  1416. $constraint = $versionParser->parseConstraints($textConstraint);
  1417. } else {
  1418. $constraint = null;
  1419. }
  1420. $renderTree = $input->getOption(self::OPTION_TREE);
  1421. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1422. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1423. if (empty($results)) {
  1424. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1425. $this->getIO()->writeError(sprintf(
  1426. '<info>There is no installed package depending on "%s"%s</info>',
  1427. $needle,
  1428. $extra
  1429. ));
  1430. } elseif ($renderTree) {
  1431. $this->initStyles($output);
  1432. $root = $packages[0];
  1433. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1434. $this->printTree($results);
  1435. } else {
  1436. $this->printTable($output, $results);
  1437. }
  1438. return 0;
  1439. }
  1440. protected function printTable(OutputInterface $output, $results)
  1441. {
  1442. $table = array();
  1443. $doubles = array();
  1444. do {
  1445. $queue = array();
  1446. $rows = array();
  1447. foreach ($results as $result) {
  1448. list($package, $link, $children) = $result;
  1449. $unique = (string) $link;
  1450. if (isset($doubles[$unique])) {
  1451. continue;
  1452. }
  1453. $doubles[$unique] = true;
  1454. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1455. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1456. if ($children) {
  1457. $queue = array_merge($queue, $children);
  1458. }
  1459. }
  1460. $results = $queue;
  1461. $table = array_merge($rows, $table);
  1462. } while (!empty($results));
  1463. $renderer = new Table($output);
  1464. $renderer->setStyle('compact');
  1465. $rendererStyle = $renderer->getStyle();
  1466. $rendererStyle->setVerticalBorderChar('');
  1467. $rendererStyle->setCellRowContentFormat('%s ');
  1468. $renderer->setRows($table)->render();
  1469. }
  1470. protected function initStyles(OutputInterface $output)
  1471. {
  1472. $this->colors = array(
  1473. 'green',
  1474. 'yellow',
  1475. 'cyan',
  1476. 'magenta',
  1477. 'blue',
  1478. );
  1479. foreach ($this->colors as $color) {
  1480. $style = new OutputFormatterStyle($color);
  1481. $output->getFormatter()->setStyle($color, $style);
  1482. }
  1483. }
  1484. protected function printTree($results, $prefix = '', $level = 1)
  1485. {
  1486. $count = count($results);
  1487. $idx = 0;
  1488. foreach ($results as $result) {
  1489. list($package, $link, $children) = $result;
  1490. $color = $this->colors[$level % count($this->colors)];
  1491. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1492. $isLast = (++$idx == $count);
  1493. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1494. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1495. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1496. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1497. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1498. if ($children) {
  1499. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1500. }
  1501. }
  1502. }
  1503. private function writeTreeLine($line)
  1504. {
  1505. $io = $this->getIO();
  1506. if (!$io->isDecorated()) {
  1507. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1508. }
  1509. $io->write($line);
  1510. }
  1511. }
  1512. <?php
  1513. namespace Composer\Command;
  1514. use Composer\Package\Link;
  1515. use Composer\Package\PackageInterface;
  1516. use Composer\Semver\Constraint\Constraint;
  1517. use Symfony\Component\Console\Helper\Table;
  1518. use Symfony\Component\Console\Input\InputInterface;
  1519. use Symfony\Component\Console\Input\InputOption;
  1520. use Symfony\Component\Console\Output\OutputInterface;
  1521. use Composer\Repository\PlatformRepository;
  1522. class CheckPlatformReqsCommand extends BaseCommand
  1523. {
  1524. protected function configure()
  1525. {
  1526. $this->setName('check-platform-reqs')
  1527. ->setDescription('Check that platform requirements are satisfied.')
  1528. ->setDefinition(array(
  1529. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1530. ))
  1531. ->setHelp(
  1532. <<<EOT
  1533. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1534. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  1535. <info>php composer.phar check-platform-reqs</info>
  1536. EOT
  1537. );
  1538. }
  1539. protected function execute(InputInterface $input, OutputInterface $output)
  1540. {
  1541. $composer = $this->getComposer();
  1542. $requires = $composer->getPackage()->getRequires();
  1543. if ($input->getOption('no-dev')) {
  1544. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1545. } else {
  1546. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1547. if (!$dependencies) {
  1548. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1549. }
  1550. $requires += $composer->getPackage()->getDevRequires();
  1551. }
  1552. foreach ($requires as $require => $link) {
  1553. $requires[$require] = array($link);
  1554. }
  1555. foreach ($dependencies as $package) {
  1556. foreach ($package->getRequires() as $require => $link) {
  1557. $requires[$require][] = $link;
  1558. }
  1559. }
  1560. ksort($requires);
  1561. $platformRepo = new PlatformRepository(array(), array());
  1562. $currentPlatformPackages = $platformRepo->getPackages();
  1563. $currentPlatformPackageMap = array();
  1564. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1565. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1566. }
  1567. $results = array();
  1568. $exitCode = 0;
  1569. foreach ($requires as $require => $links) {
  1570. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1571. if (isset($currentPlatformPackageMap[$require])) {
  1572. $pass = true;
  1573. $version = $currentPlatformPackageMap[$require]->getVersion();
  1574. foreach ($links as $link) {
  1575. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1576. $results[] = array(
  1577. $currentPlatformPackageMap[$require]->getPrettyName(),
  1578. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1579. $link,
  1580. '<error>failed</error>',
  1581. );
  1582. $pass = false;
  1583. $exitCode = max($exitCode, 1);
  1584. }
  1585. }
  1586. if ($pass) {
  1587. $results[] = array(
  1588. $currentPlatformPackageMap[$require]->getPrettyName(),
  1589. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1590. null,
  1591. '<info>success</info>',
  1592. );
  1593. }
  1594. } else {
  1595. $results[] = array(
  1596. $require,
  1597. 'n/a',
  1598. $links[0],
  1599. '<error>missing</error>',
  1600. );
  1601. $exitCode = max($exitCode, 2);
  1602. }
  1603. }
  1604. }
  1605. $this->printTable($output, $results);
  1606. return $exitCode;
  1607. }
  1608. protected function printTable(OutputInterface $output, $results)
  1609. {
  1610. $table = array();
  1611. $rows = array();
  1612. foreach ($results as $result) {
  1613. list($platformPackage, $version, $link, $status) = $result;
  1614. $rows[] = array(
  1615. $platformPackage,
  1616. $version,
  1617. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1618. $status,
  1619. );
  1620. }
  1621. $table = array_merge($rows, $table);
  1622. $renderer = new Table($output);
  1623. $renderer->setStyle('compact');
  1624. $rendererStyle = $renderer->getStyle();
  1625. $rendererStyle->setVerticalBorderChar('');
  1626. $rendererStyle->setCellRowContentFormat('%s ');
  1627. $renderer->setRows($table)->render();
  1628. }
  1629. }
  1630. <?php
  1631. namespace Composer\Command;
  1632. use Composer\Cache;
  1633. use Composer\Factory;
  1634. use Symfony\Component\Console\Input\InputInterface;
  1635. use Symfony\Component\Console\Output\OutputInterface;
  1636. class ClearCacheCommand extends BaseCommand
  1637. {
  1638. protected function configure()
  1639. {
  1640. $this
  1641. ->setName('clear-cache')
  1642. ->setAliases(array('clearcache'))
  1643. ->setDescription('Clears composer\'s internal package cache.')
  1644. ->setHelp(
  1645. <<<EOT
  1646. The <info>clear-cache</info> deletes all cached packages from composer's
  1647. cache directory.
  1648. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-
  1649. EOT
  1650. )
  1651. ;
  1652. }
  1653. protected function execute(InputInterface $input, OutputInterface $output)
  1654. {
  1655. $config = Factory::createConfig();
  1656. $io = $this->getIO();
  1657. $cachePaths = array(
  1658. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1659. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1660. 'cache-files-dir' => $config->get('cache-files-dir'),
  1661. 'cache-dir' => $config->get('cache-dir'),
  1662. );
  1663. foreach ($cachePaths as $key => $cachePath) {
  1664. $cachePath = realpath($cachePath);
  1665. if (!$cachePath) {
  1666. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1667. continue;
  1668. }
  1669. $cache = new Cache($io, $cachePath);
  1670. if (!$cache->isEnabled()) {
  1671. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1672. continue;
  1673. }
  1674. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1675. $cache->clear();
  1676. }
  1677. $io->writeError('<info>All caches cleared.</info>');
  1678. }
  1679. }
  1680. <?php
  1681. namespace Composer\Command;
  1682. use Composer\Util\Platform;
  1683. use Composer\Util\Silencer;
  1684. use Symfony\Component\Console\Input\InputInterface;
  1685. use Symfony\Component\Console\Input\InputArgument;
  1686. use Symfony\Component\Console\Input\InputOption;
  1687. use Symfony\Component\Console\Output\OutputInterface;
  1688. use Composer\Config;
  1689. use Composer\Config\JsonConfigSource;
  1690. use Composer\Factory;
  1691. use Composer\IO\IOInterface;
  1692. use Composer\Json\JsonFile;
  1693. use Composer\Semver\VersionParser;
  1694. use Composer\Package\BasePackage;
  1695. class ConfigCommand extends BaseCommand
  1696. {
  1697. protected $config;
  1698. protected $configFile;
  1699. protected $configSource;
  1700. protected $authConfigFile;
  1701. protected $authConfigSource;
  1702. protected function configure()
  1703. {
  1704. $this
  1705. ->setName('config')
  1706. ->setDescription('Sets config options.')
  1707. ->setDefinition(array(
  1708. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1709. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1710. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1711. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1712. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1713. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1714. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1715. new InputArgument('setting-key', null, 'Setting key'),
  1716. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1717. ))
  1718. ->setHelp(
  1719. <<<EOT
  1720. This command allows you to edit composer config settings and repositories
  1721. in either the local composer.json file or the global config.json file.
  1722. Additionally it lets you edit most properties in the local composer.json.
  1723. To set a config setting:
  1724. <comment>%command.full_name% bin-dir bin/</comment>
  1725. To read a config setting:
  1726. <comment>%command.full_name% bin-dir</comment>
  1727. Outputs: <info>bin</info>
  1728. To edit the global config.json file:
  1729. <comment>%command.full_name% --global</comment>
  1730. To add a repository:
  1731. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1732. To remove a repository (repo is a short alias for repositories):
  1733. <comment>%command.full_name% --unset repo.foo</comment>
  1734. To disable packagist:
  1735. <comment>%command.full_name% repo.packagist false</comment>
  1736. You can alter repositories in the global config.json file by passing in the
  1737. <info>--global</info> option.
  1738. To edit the file in an external editor:
  1739. <comment>%command.full_name% --editor</comment>
  1740. To choose your editor you can set the "EDITOR" env variable.
  1741. To get a list of configuration values in the file:
  1742. <comment>%command.full_name% --list</comment>
  1743. You can always pass more than one option. As an example, if you want to edit the
  1744. global config.json file.
  1745. <comment>%command.full_name% --editor --global</comment>
  1746. Read more at https://getcomposer.org/doc/03-cli.md#config
  1747. EOT
  1748. )
  1749. ;
  1750. }
  1751. protected function initialize(InputInterface $input, OutputInterface $output)
  1752. {
  1753. parent::initialize($input, $output);
  1754. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1755. throw new \RuntimeException('--file and --global can not be combined');
  1756. }
  1757. $io = $this->getIO();
  1758. $this->config = Factory::createConfig($io);
  1759. $configFile = $input->getOption('global')
  1760. ? ($this->config->get('home') . '/config.json')
  1761. : ($input->getOption('file') ?: Factory::getComposerFile());
  1762. if (
  1763. ($configFile === 'composer.json' || $configFile === './composer.json')
  1764. && !file_exists($configFile)
  1765. && realpath(getcwd()) === realpath($this->config->get('home'))
  1766. ) {
  1767. file_put_contents($configFile, "{\n}\n");
  1768. }
  1769. $this->configFile = new JsonFile($configFile, null, $io);
  1770. $this->configSource = new JsonConfigSource($this->configFile);
  1771. $authConfigFile = $input->getOption('global')
  1772. ? ($this->config->get('home') . '/auth.json')
  1773. : dirname(realpath($configFile)) . '/auth.json';
  1774. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1775. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1776. if ($input->getOption('global') && !$this->configFile->exists()) {
  1777. touch($this->configFile->getPath());
  1778. $this->configFile->write(array('config' => new \ArrayObject));
  1779. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1780. }
  1781. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1782. touch($this->authConfigFile->getPath());
  1783. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1784. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1785. }
  1786. if (!$this->configFile->exists()) {
  1787. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1788. }
  1789. }
  1790. protected function execute(InputInterface $input, OutputInterface $output)
  1791. {
  1792. if ($input->getOption('editor')) {
  1793. $editor = escapeshellcmd(getenv('EDITOR'));
  1794. if (!$editor) {
  1795. if (Platform::isWindows()) {
  1796. $editor = 'notepad';
  1797. } else {
  1798. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1799. if (exec('which '.$candidate)) {
  1800. $editor = $candidate;
  1801. break;
  1802. }
  1803. }
  1804. }
  1805. }
  1806. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1807. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1808. return 0;
  1809. }
  1810. if (!$input->getOption('global')) {
  1811. $this->config->merge($this->configFile->read());
  1812. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1813. }
  1814. if ($input->getOption('list')) {
  1815. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1816. return 0;
  1817. }
  1818. $settingKey = $input->getArgument('setting-key');
  1819. if (!$settingKey) {
  1820. return 0;
  1821. }
  1822. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1823. throw new \RuntimeException('You can not combine a setting value with --unset');
  1824. }
  1825. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1826. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1827. $rawData = $this->configFile->read();
  1828. $data = $this->config->all();
  1829. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1830. if (!isset($matches[1]) || $matches[1] === '') {
  1831. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1832. } else {
  1833. if (!isset($data['repositories'][$matches[1]])) {
  1834. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1835. }
  1836. $value = $data['repositories'][$matches[1]];
  1837. }
  1838. } elseif (strpos($settingKey, '.')) {
  1839. $bits = explode('.', $settingKey);
  1840. if ($bits[0] === 'extra') {
  1841. $data = $rawData;
  1842. } else {
  1843. $data = $data['config'];
  1844. }
  1845. $match = false;
  1846. foreach ($bits as $bit) {
  1847. $key = isset($key) ? $key.'.'.$bit : $bit;
  1848. $match = false;
  1849. if (isset($data[$key])) {
  1850. $match = true;
  1851. $data = $data[$key];
  1852. unset($key);
  1853. }
  1854. }
  1855. if (!$match) {
  1856. throw new \RuntimeException($settingKey.' is not defined.');
  1857. }
  1858. $value = $data;
  1859. } elseif (isset($data['config'][$settingKey])) {
  1860. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1861. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1862. $value = $rawData[$settingKey];
  1863. } else {
  1864. throw new \RuntimeException($settingKey.' is not defined');
  1865. }
  1866. if (is_array($value)) {
  1867. $value = json_encode($value);
  1868. }
  1869. $this->getIO()->write($value, true, IOInterface::QUIET);
  1870. return 0;
  1871. }
  1872. $values = $input->getArgument('setting-value');
  1873. $booleanValidator = function ($val) {
  1874. return in_array($val, array('true', 'false', '1', '0'), true);
  1875. };
  1876. $booleanNormalizer = function ($val) {
  1877. return $val !== 'false' && (bool) $val;
  1878. };
  1879. $uniqueConfigValues = array(
  1880. 'process-timeout' => array('is_numeric', 'intval'),
  1881. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1882. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  1883. 'preferred-install' => array(
  1884. function ($val) {
  1885. return in_array($val, array('auto', 'source', 'dist'), true);
  1886. },
  1887. function ($val) {
  1888. return $val;
  1889. },
  1890. ),
  1891. 'store-auths' => array(
  1892. function ($val) {
  1893. return in_array($val, array('true', 'false', 'prompt'), true);
  1894. },
  1895. function ($val) {
  1896. if ('prompt' === $val) {
  1897. return 'prompt';
  1898. }
  1899. return $val !== 'false' && (bool) $val;
  1900. },
  1901. ),
  1902. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1903. 'vendor-dir' => array('is_string', function ($val) {
  1904. return $val;
  1905. }),
  1906. 'bin-dir' => array('is_string', function ($val) {
  1907. return $val;
  1908. }),
  1909. 'archive-dir' => array('is_string', function ($val) {
  1910. return $val;
  1911. }),
  1912. 'archive-format' => array('is_string', function ($val) {
  1913. return $val;
  1914. }),
  1915. 'data-dir' => array('is_string', function ($val) {
  1916. return $val;
  1917. }),
  1918. 'cache-dir' => array('is_string', function ($val) {
  1919. return $val;
  1920. }),
  1921. 'cache-files-dir' => array('is_string', function ($val) {
  1922. return $val;
  1923. }),
  1924. 'cache-repo-dir' => array('is_string', function ($val) {
  1925. return $val;
  1926. }),
  1927. 'cache-vcs-dir' => array('is_string', function ($val) {
  1928. return $val;
  1929. }),
  1930. 'cache-ttl' => array('is_numeric', 'intval'),
  1931. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1932. 'cache-files-maxsize' => array(
  1933. function ($val) {
  1934. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1935. },
  1936. function ($val) {
  1937. return $val;
  1938. },
  1939. ),
  1940. 'bin-compat' => array(
  1941. function ($val) {
  1942. return in_array($val, array('auto', 'full'));
  1943. },
  1944. function ($val) {
  1945. return $val;
  1946. },
  1947. ),
  1948. 'discard-changes' => array(
  1949. function ($val) {
  1950. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1951. },
  1952. function ($val) {
  1953. if ('stash' === $val) {
  1954. return 'stash';
  1955. }
  1956. return $val !== 'false' && (bool) $val;
  1957. },
  1958. ),
  1959. 'autoloader-suffix' => array('is_string', function ($val) {
  1960. return $val === 'null' ? null : $val;
  1961. }),
  1962. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1963. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1964. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1965. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1966. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1967. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1968. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1969. 'cafile' => array(
  1970. function ($val) {
  1971. return file_exists($val) && is_readable($val);
  1972. },
  1973. function ($val) {
  1974. return $val === 'null' ? null : $val;
  1975. },
  1976. ),
  1977. 'capath' => array(
  1978. function ($val) {
  1979. return is_dir($val) && is_readable($val);
  1980. },
  1981. function ($val) {
  1982. return $val === 'null' ? null : $val;
  1983. },
  1984. ),
  1985. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1986. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1987. );
  1988. $multiConfigValues = array(
  1989. 'github-protocols' => array(
  1990. function ($vals) {
  1991. if (!is_array($vals)) {
  1992. return 'array expected';
  1993. }
  1994. foreach ($vals as $val) {
  1995. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1996. return 'valid protocols include: git, https, ssh';
  1997. }
  1998. }
  1999. return true;
  2000. },
  2001. function ($vals) {
  2002. return $vals;
  2003. },
  2004. ),
  2005. 'github-domains' => array(
  2006. function ($vals) {
  2007. if (!is_array($vals)) {
  2008. return 'array expected';
  2009. }
  2010. return true;
  2011. },
  2012. function ($vals) {
  2013. return $vals;
  2014. },
  2015. ),
  2016. 'gitlab-domains' => array(
  2017. function ($vals) {
  2018. if (!is_array($vals)) {
  2019. return 'array expected';
  2020. }
  2021. return true;
  2022. },
  2023. function ($vals) {
  2024. return $vals;
  2025. },
  2026. ),
  2027. );
  2028. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2029. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2030. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2031. }
  2032. return $this->configSource->removeConfigSetting($settingKey);
  2033. }
  2034. if (isset($uniqueConfigValues[$settingKey])) {
  2035. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2036. }
  2037. if (isset($multiConfigValues[$settingKey])) {
  2038. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2039. }
  2040. $uniqueProps = array(
  2041. 'name' => array('is_string', function ($val) {
  2042. return $val;
  2043. }),
  2044. 'type' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'description' => array('is_string', function ($val) {
  2048. return $val;
  2049. }),
  2050. 'homepage' => array('is_string', function ($val) {
  2051. return $val;
  2052. }),
  2053. 'version' => array('is_string', function ($val) {
  2054. return $val;
  2055. }),
  2056. 'minimum-stability' => array(
  2057. function ($val) {
  2058. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2059. },
  2060. function ($val) {
  2061. return VersionParser::normalizeStability($val);
  2062. },
  2063. ),
  2064. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2065. );
  2066. $multiProps = array(
  2067. 'keywords' => array(
  2068. function ($vals) {
  2069. if (!is_array($vals)) {
  2070. return 'array expected';
  2071. }
  2072. return true;
  2073. },
  2074. function ($vals) {
  2075. return $vals;
  2076. },
  2077. ),
  2078. 'license' => array(
  2079. function ($vals) {
  2080. if (!is_array($vals)) {
  2081. return 'array expected';
  2082. }
  2083. return true;
  2084. },
  2085. function ($vals) {
  2086. return $vals;
  2087. },
  2088. ),
  2089. );
  2090. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2091. 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');
  2092. }
  2093. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2094. return $this->configSource->removeProperty($settingKey);
  2095. }
  2096. if (isset($uniqueProps[$settingKey])) {
  2097. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2098. }
  2099. if (isset($multiProps[$settingKey])) {
  2100. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2101. }
  2102. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2103. if ($input->getOption('unset')) {
  2104. return $this->configSource->removeRepository($matches[1]);
  2105. }
  2106. if (2 === count($values)) {
  2107. return $this->configSource->addRepository($matches[1], array(
  2108. 'type' => $values[0],
  2109. 'url' => $values[1],
  2110. ));
  2111. }
  2112. if (1 === count($values)) {
  2113. $value = strtolower($values[0]);
  2114. if (true === $booleanValidator($value)) {
  2115. if (false === $booleanNormalizer($value)) {
  2116. return $this->configSource->addRepository($matches[1], false);
  2117. }
  2118. } else {
  2119. $value = JsonFile::parseJson($values[0]);
  2120. return $this->configSource->addRepository($matches[1], $value);
  2121. }
  2122. }
  2123. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2124. }
  2125. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2126. if ($input->getOption('unset')) {
  2127. return $this->configSource->removeProperty($settingKey);
  2128. }
  2129. return $this->configSource->addProperty($settingKey, $values[0]);
  2130. }
  2131. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2132. if ($input->getOption('unset')) {
  2133. return $this->configSource->removeConfigSetting($settingKey);
  2134. }
  2135. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2136. }
  2137. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2138. return $this->configSource->removeConfigSetting($settingKey);
  2139. }
  2140. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2141. if ($input->getOption('unset')) {
  2142. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2143. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2144. return;
  2145. }
  2146. if ($matches[1] === 'bitbucket-oauth') {
  2147. if (2 !== count($values)) {
  2148. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2149. }
  2150. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2151. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2152. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2153. if (1 !== count($values)) {
  2154. throw new \RuntimeException('Too many arguments, expected only one token');
  2155. }
  2156. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2157. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2158. } elseif ($matches[1] === 'http-basic') {
  2159. if (2 !== count($values)) {
  2160. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2161. }
  2162. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2163. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2164. }
  2165. return;
  2166. }
  2167. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2168. if ($input->getOption('unset')) {
  2169. return $this->configSource->removeProperty($settingKey);
  2170. }
  2171. return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2172. }
  2173. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2174. }
  2175. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2176. {
  2177. list($validator, $normalizer) = $callbacks;
  2178. if (1 !== count($values)) {
  2179. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2180. }
  2181. if (true !== $validation = $validator($values[0])) {
  2182. throw new \RuntimeException(sprintf(
  2183. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2184. $values[0]
  2185. ));
  2186. }
  2187. $normalizedValue = $normalizer($values[0]);
  2188. if ($key === 'disable-tls') {
  2189. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2190. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2191. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2192. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2193. }
  2194. }
  2195. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2196. }
  2197. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2198. {
  2199. list($validator, $normalizer) = $callbacks;
  2200. if (true !== $validation = $validator($values)) {
  2201. throw new \RuntimeException(sprintf(
  2202. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2203. json_encode($values)
  2204. ));
  2205. }
  2206. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2207. }
  2208. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2209. {
  2210. $origK = $k;
  2211. $io = $this->getIO();
  2212. foreach ($contents as $key => $value) {
  2213. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2214. continue;
  2215. }
  2216. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2217. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2218. $k .= preg_replace('{^config\.}', '', $key . '.');
  2219. $this->listConfiguration($value, $rawVal, $output, $k);
  2220. $k = $origK;
  2221. continue;
  2222. }
  2223. if (is_array($value)) {
  2224. $value = array_map(function ($val) {
  2225. return is_array($val) ? json_encode($val) : $val;
  2226. }, $value);
  2227. $value = '['.implode(', ', $value).']';
  2228. }
  2229. if (is_bool($value)) {
  2230. $value = var_export($value, true);
  2231. }
  2232. if (is_string($rawVal) && $rawVal != $value) {
  2233. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2234. } else {
  2235. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2236. }
  2237. }
  2238. }
  2239. }
  2240. <?php
  2241. namespace Composer\Command;
  2242. use Composer\Config;
  2243. use Composer\Factory;
  2244. use Composer\Installer;
  2245. use Composer\Installer\ProjectInstaller;
  2246. use Composer\Installer\InstallationManager;
  2247. use Composer\Installer\SuggestedPackagesReporter;
  2248. use Composer\IO\IOInterface;
  2249. use Composer\Package\BasePackage;
  2250. use Composer\DependencyResolver\Pool;
  2251. use Composer\DependencyResolver\Operation\InstallOperation;
  2252. use Composer\Package\Version\VersionSelector;
  2253. use Composer\Package\AliasPackage;
  2254. use Composer\Repository\RepositoryFactory;
  2255. use Composer\Repository\CompositeRepository;
  2256. use Composer\Repository\PlatformRepository;
  2257. use Composer\Repository\InstalledFilesystemRepository;
  2258. use Composer\Script\ScriptEvents;
  2259. use Composer\Util\Silencer;
  2260. use Symfony\Component\Console\Input\InputArgument;
  2261. use Symfony\Component\Console\Input\InputInterface;
  2262. use Symfony\Component\Console\Input\InputOption;
  2263. use Symfony\Component\Console\Output\OutputInterface;
  2264. use Symfony\Component\Finder\Finder;
  2265. use Composer\Json\JsonFile;
  2266. use Composer\Config\JsonConfigSource;
  2267. use Composer\Util\Filesystem;
  2268. use Composer\Package\Version\VersionParser;
  2269. class CreateProjectCommand extends BaseCommand
  2270. {
  2271. protected $suggestedPackagesReporter;
  2272. protected function configure()
  2273. {
  2274. $this
  2275. ->setName('create-project')
  2276. ->setDescription('Creates new project from a package into given directory.')
  2277. ->setDefinition(array(
  2278. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2279. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2280. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2281. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2282. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2283. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2284. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2285. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2286. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2287. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2288. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2289. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2290. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2291. 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.'),
  2292. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2293. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2294. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2295. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2296. ))
  2297. ->setHelp(
  2298. <<<EOT
  2299. The <info>create-project</info> command creates a new project from a given
  2300. package into a new directory. If executed without params and in a directory
  2301. with a composer.json file it installs the packages for the current project.
  2302. You can use this command to bootstrap new projects or setup a clean
  2303. version-controlled installation for developers of your project.
  2304. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2305. You can also specify the version with the package name using = or : as separator.
  2306. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2307. To install unstable packages, either specify the version you want, or use the
  2308. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2309. To setup a developer workable version you should create the project using the source
  2310. controlled code by appending the <info>'--prefer-source'</info> flag.
  2311. To install a package from another repository than the default one you
  2312. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2313. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2314. EOT
  2315. )
  2316. ;
  2317. }
  2318. protected function execute(InputInterface $input, OutputInterface $output)
  2319. {
  2320. $config = Factory::createConfig();
  2321. $io = $this->getIO();
  2322. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2323. if ($input->getOption('dev')) {
  2324. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2325. }
  2326. if ($input->getOption('no-custom-installers')) {
  2327. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2328. $input->setOption('no-plugins', true);
  2329. }
  2330. return $this->installProject(
  2331. $io,
  2332. $config,
  2333. $input,
  2334. $input->getArgument('package'),
  2335. $input->getArgument('directory'),
  2336. $input->getArgument('version'),
  2337. $input->getOption('stability'),
  2338. $preferSource,
  2339. $preferDist,
  2340. !$input->getOption('no-dev'),
  2341. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2342. $input->getOption('no-plugins'),
  2343. $input->getOption('no-scripts'),
  2344. $input->getOption('no-progress'),
  2345. $input->getOption('no-install'),
  2346. $input->getOption('ignore-platform-reqs'),
  2347. !$input->getOption('no-secure-http')
  2348. );
  2349. }
  2350. 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, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2351. {
  2352. $oldCwd = getcwd();
  2353. $io->loadConfiguration($config);
  2354. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2355. if ($packageName !== null) {
  2356. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2357. } else {
  2358. $installedFromVcs = false;
  2359. }
  2360. $composer = Factory::create($io, null, $disablePlugins);
  2361. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2362. $fs = new Filesystem();
  2363. if ($noScripts === false) {
  2364. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2365. }
  2366. $config = $composer->getConfig();
  2367. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2368. if ($noInstall === false) {
  2369. $installer = Installer::create($io, $composer);
  2370. $installer->setPreferSource($preferSource)
  2371. ->setPreferDist($preferDist)
  2372. ->setDevMode($installDevPackages)
  2373. ->setRunScripts(!$noScripts)
  2374. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2375. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2376. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2377. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2378. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2379. if ($disablePlugins) {
  2380. $installer->disablePlugins();
  2381. }
  2382. $status = $installer->run();
  2383. if (0 !== $status) {
  2384. return $status;
  2385. }
  2386. }
  2387. $hasVcs = $installedFromVcs;
  2388. if (
  2389. !$input->getOption('keep-vcs')
  2390. && $installedFromVcs
  2391. && (
  2392. $input->getOption('remove-vcs')
  2393. || !$io->isInteractive()
  2394. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2395. )
  2396. ) {
  2397. $finder = new Finder();
  2398. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2399. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2400. $finder->name($vcsName);
  2401. }
  2402. try {
  2403. $dirs = iterator_to_array($finder);
  2404. unset($finder);
  2405. foreach ($dirs as $dir) {
  2406. if (!$fs->removeDirectory($dir)) {
  2407. throw new \RuntimeException('Could not remove '.$dir);
  2408. }
  2409. }
  2410. } catch (\Exception $e) {
  2411. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2412. }
  2413. $hasVcs = false;
  2414. }
  2415. if (!$hasVcs) {
  2416. $package = $composer->getPackage();
  2417. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2418. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2419. foreach ($package->{'get'.$meta['method']}() as $link) {
  2420. if ($link->getPrettyConstraint() === 'self.version') {
  2421. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2422. }
  2423. }
  2424. }
  2425. }
  2426. if ($noScripts === false) {
  2427. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2428. }
  2429. chdir($oldCwd);
  2430. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2431. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2432. Silencer::call('rmdir', $vendorComposerDir);
  2433. $vendorDir = $config->get('vendor-dir');
  2434. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2435. Silencer::call('rmdir', $vendorDir);
  2436. }
  2437. }
  2438. return 0;
  2439. }
  2440. 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, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2441. {
  2442. if (!$secureHttp) {
  2443. $config->merge(array('config' => array('secure-http' => false)));
  2444. }
  2445. if (null === $repository) {
  2446. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2447. } else {
  2448. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2449. }
  2450. $parser = new VersionParser();
  2451. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2452. $name = strtolower($requirements[0]['name']);
  2453. if (!$packageVersion && isset($requirements[0]['version'])) {
  2454. $packageVersion = $requirements[0]['version'];
  2455. }
  2456. if (null === $stability) {
  2457. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2458. $stability = $match[1];
  2459. } else {
  2460. $stability = VersionParser::parseStability($packageVersion);
  2461. }
  2462. }
  2463. $stability = VersionParser::normalizeStability($stability);
  2464. if (!isset(BasePackage::$stabilities[$stability])) {
  2465. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2466. }
  2467. $pool = new Pool($stability);
  2468. $pool->addRepository($sourceRepo);
  2469. $phpVersion = null;
  2470. $prettyPhpVersion = null;
  2471. if (!$ignorePlatformReqs) {
  2472. $platformOverrides = $config->get('platform') ?: array();
  2473. $platform = new PlatformRepository(array(), $platformOverrides);
  2474. $phpPackage = $platform->findPackage('php', '*');
  2475. $phpVersion = $phpPackage->getVersion();
  2476. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2477. }
  2478. $versionSelector = new VersionSelector($pool);
  2479. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2480. if (!$package) {
  2481. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2482. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2483. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2484. }
  2485. throw new \InvalidArgumentException($errorMessage .'.');
  2486. }
  2487. if (null === $directory) {
  2488. $parts = explode("/", $name, 2);
  2489. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2490. }
  2491. if (function_exists('pcntl_async_signals')) {
  2492. @mkdir($directory, 0777, true);
  2493. if ($realDir = realpath($directory)) {
  2494. pcntl_async_signals(true);
  2495. pcntl_signal(SIGINT, function () use ($realDir) {
  2496. $fs = new Filesystem();
  2497. $fs->removeDirectory($realDir);
  2498. exit(130);
  2499. });
  2500. }
  2501. }
  2502. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2503. if ($disablePlugins) {
  2504. $io->writeError('<info>Plugins have been disabled.</info>');
  2505. }
  2506. if ($package instanceof AliasPackage) {
  2507. $package = $package->getAliasOf();
  2508. }
  2509. $dm = $this->createDownloadManager($io, $config);
  2510. $dm->setPreferSource($preferSource)
  2511. ->setPreferDist($preferDist)
  2512. ->setOutputProgress(!$noProgress);
  2513. $projectInstaller = new ProjectInstaller($directory, $dm);
  2514. $im = $this->createInstallationManager();
  2515. $im->addInstaller($projectInstaller);
  2516. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2517. $im->notifyInstalls($io);
  2518. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2519. $installedFromVcs = 'source' === $package->getInstallationSource();
  2520. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2521. chdir($directory);
  2522. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2523. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2524. return $installedFromVcs;
  2525. }
  2526. protected function createDownloadManager(IOInterface $io, Config $config)
  2527. {
  2528. $factory = new Factory();
  2529. return $factory->createDownloadManager($io, $config);
  2530. }
  2531. protected function createInstallationManager()
  2532. {
  2533. return new InstallationManager();
  2534. }
  2535. }
  2536. <?php
  2537. namespace Composer\Command;
  2538. use Symfony\Component\Console\Input\InputInterface;
  2539. use Symfony\Component\Console\Output\OutputInterface;
  2540. class DependsCommand extends BaseDependencyCommand
  2541. {
  2542. protected function configure()
  2543. {
  2544. parent::configure();
  2545. $this
  2546. ->setName('depends')
  2547. ->setAliases(array('why'))
  2548. ->setDescription('Shows which packages cause the given package to be installed.')
  2549. ->setHelp(
  2550. <<<EOT
  2551. Displays detailed information about where a package is referenced.
  2552. <info>php composer.phar depends composer/composer</info>
  2553. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2554. EOT
  2555. )
  2556. ;
  2557. }
  2558. protected function execute(InputInterface $input, OutputInterface $output)
  2559. {
  2560. return parent::doExecute($input, $output, false);
  2561. }
  2562. }
  2563. <?php
  2564. namespace Composer\Command;
  2565. use Composer\Composer;
  2566. use Composer\Factory;
  2567. use Composer\Config;
  2568. use Composer\Downloader\TransportException;
  2569. use Composer\Repository\PlatformRepository;
  2570. use Composer\Plugin\CommandEvent;
  2571. use Composer\Plugin\PluginEvents;
  2572. use Composer\Util\ConfigValidator;
  2573. use Composer\Util\IniHelper;
  2574. use Composer\Util\ProcessExecutor;
  2575. use Composer\Util\RemoteFilesystem;
  2576. use Composer\Util\StreamContextFactory;
  2577. use Composer\SelfUpdate\Keys;
  2578. use Composer\SelfUpdate\Versions;
  2579. use Composer\IO\NullIO;
  2580. use Symfony\Component\Console\Input\InputInterface;
  2581. use Symfony\Component\Console\Output\OutputInterface;
  2582. class DiagnoseCommand extends BaseCommand
  2583. {
  2584. protected $rfs;
  2585. protected $process;
  2586. protected $exitCode = 0;
  2587. protected function configure()
  2588. {
  2589. $this
  2590. ->setName('diagnose')
  2591. ->setDescription('Diagnoses the system to identify common errors.')
  2592. ->setHelp(
  2593. <<<EOT
  2594. The <info>diagnose</info> command checks common errors to help debugging problems.
  2595. The process exit code will be 1 in case of warnings and 2 for errors.
  2596. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2597. EOT
  2598. )
  2599. ;
  2600. }
  2601. protected function execute(InputInterface $input, OutputInterface $output)
  2602. {
  2603. $composer = $this->getComposer(false);
  2604. $io = $this->getIO();
  2605. if ($composer) {
  2606. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2607. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2608. $io->write('Checking composer.json: ', false);
  2609. $this->outputResult($this->checkComposerSchema());
  2610. }
  2611. if ($composer) {
  2612. $config = $composer->getConfig();
  2613. } else {
  2614. $config = Factory::createConfig();
  2615. }
  2616. $config->merge(array('config' => array('secure-http' => false)));
  2617. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2618. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2619. $this->process = new ProcessExecutor($io);
  2620. $io->write('Checking platform settings: ', false);
  2621. $this->outputResult($this->checkPlatform());
  2622. $io->write('Checking git settings: ', false);
  2623. $this->outputResult($this->checkGit());
  2624. $io->write('Checking http connectivity to packagist: ', false);
  2625. $this->outputResult($this->checkHttp('http', $config));
  2626. $io->write('Checking https connectivity to packagist: ', false);
  2627. $this->outputResult($this->checkHttp('https', $config));
  2628. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2629. if (!empty($opts['http']['proxy'])) {
  2630. $io->write('Checking HTTP proxy: ', false);
  2631. $this->outputResult($this->checkHttpProxy());
  2632. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2633. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2634. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2635. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2636. }
  2637. if ($oauth = $config->get('github-oauth')) {
  2638. foreach ($oauth as $domain => $token) {
  2639. $io->write('Checking '.$domain.' oauth access: ', false);
  2640. $this->outputResult($this->checkGithubOauth($domain, $token));
  2641. }
  2642. } else {
  2643. $io->write('Checking github.com rate limit: ', false);
  2644. try {
  2645. $rate = $this->getGithubRateLimit('github.com');
  2646. if (!is_array($rate)) {
  2647. $this->outputResult($rate);
  2648. } elseif (10 > $rate['remaining']) {
  2649. $io->write('<warning>WARNING</warning>');
  2650. $io->write(sprintf(
  2651. '<comment>Github has a rate limit on their API. '
  2652. . 'You currently have <options=bold>%u</options=bold> '
  2653. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2654. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2655. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2656. $rate['remaining'],
  2657. $rate['limit']
  2658. ));
  2659. } else {
  2660. $this->outputResult(true);
  2661. }
  2662. } catch (\Exception $e) {
  2663. if ($e instanceof TransportException && $e->getCode() === 401) {
  2664. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2665. } else {
  2666. $this->outputResult($e);
  2667. }
  2668. }
  2669. }
  2670. $io->write('Checking disk free space: ', false);
  2671. $this->outputResult($this->checkDiskSpace($config));
  2672. if ('phar:' === substr(__FILE__, 0, 5)) {
  2673. $io->write('Checking pubkeys: ', false);
  2674. $this->outputResult($this->checkPubKeys($config));
  2675. $io->write('Checking composer version: ', false);
  2676. $this->outputResult($this->checkVersion($config));
  2677. }
  2678. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2679. $platformOverrides = $config->get('platform') ?: array();
  2680. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2681. $phpPkg = $platformRepo->findPackage('php', '*');
  2682. $phpVersion = $phpPkg->getPrettyVersion();
  2683. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2684. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2685. }
  2686. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2687. if (defined('PHP_BINARY')) {
  2688. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2689. }
  2690. return $this->exitCode;
  2691. }
  2692. private function checkComposerSchema()
  2693. {
  2694. $validator = new ConfigValidator($this->getIO());
  2695. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2696. if ($errors || $warnings) {
  2697. $messages = array(
  2698. 'error' => $errors,
  2699. 'warning' => $warnings,
  2700. );
  2701. $output = '';
  2702. foreach ($messages as $style => $msgs) {
  2703. foreach ($msgs as $msg) {
  2704. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2705. }
  2706. }
  2707. return rtrim($output);
  2708. }
  2709. return true;
  2710. }
  2711. private function checkGit()
  2712. {
  2713. $this->process->execute('git config color.ui', $output);
  2714. if (strtolower(trim($output)) === 'always') {
  2715. 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>';
  2716. }
  2717. return true;
  2718. }
  2719. private function checkHttp($proto, Config $config)
  2720. {
  2721. $result = $this->checkConnectivity();
  2722. if ($result !== true) {
  2723. return $result;
  2724. }
  2725. $disableTls = false;
  2726. $result = array();
  2727. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2728. $disableTls = true;
  2729. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2730. }
  2731. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2732. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2733. }
  2734. try {
  2735. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2736. } catch (TransportException $e) {
  2737. if (false !== strpos($e->getMessage(), 'cafile')) {
  2738. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2739. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2740. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2741. } else {
  2742. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2743. }
  2744. }
  2745. if (count($result) > 0) {
  2746. return $result;
  2747. }
  2748. return true;
  2749. }
  2750. private function checkHttpProxy()
  2751. {
  2752. $result = $this->checkConnectivity();
  2753. if ($result !== true) {
  2754. return $result;
  2755. }
  2756. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2757. try {
  2758. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2759. $hash = reset($json['provider-includes']);
  2760. $hash = $hash['sha256'];
  2761. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2762. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2763. if (hash('sha256', $provider) !== $hash) {
  2764. return 'It seems that your proxy is modifying http traffic on the fly';
  2765. }
  2766. } catch (\Exception $e) {
  2767. return $e;
  2768. }
  2769. return true;
  2770. }
  2771. private function checkHttpProxyFullUriRequestParam()
  2772. {
  2773. $result = $this->checkConnectivity();
  2774. if ($result !== true) {
  2775. return $result;
  2776. }
  2777. $url = 'http://repo.packagist.org/packages.json';
  2778. try {
  2779. $this->rfs->getContents('packagist.org', $url, false);
  2780. } catch (TransportException $e) {
  2781. try {
  2782. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2783. } catch (TransportException $e) {
  2784. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2785. }
  2786. 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"';
  2787. }
  2788. return true;
  2789. }
  2790. private function checkHttpsProxyFullUriRequestParam()
  2791. {
  2792. $result = $this->checkConnectivity();
  2793. if ($result !== true) {
  2794. return $result;
  2795. }
  2796. if (!extension_loaded('openssl')) {
  2797. return 'You need the openssl extension installed for this check';
  2798. }
  2799. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2800. try {
  2801. $this->rfs->getContents('github.com', $url, false);
  2802. } catch (TransportException $e) {
  2803. try {
  2804. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2805. } catch (TransportException $e) {
  2806. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2807. }
  2808. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2809. }
  2810. return true;
  2811. }
  2812. private function checkGithubOauth($domain, $token)
  2813. {
  2814. $result = $this->checkConnectivity();
  2815. if ($result !== true) {
  2816. return $result;
  2817. }
  2818. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2819. try {
  2820. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2821. return $this->rfs->getContents($domain, $url, false, array(
  2822. 'retry-auth-failure' => false,
  2823. )) ? true : 'Unexpected error';
  2824. } catch (\Exception $e) {
  2825. if ($e instanceof TransportException && $e->getCode() === 401) {
  2826. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2827. }
  2828. return $e;
  2829. }
  2830. }
  2831. private function getGithubRateLimit($domain, $token = null)
  2832. {
  2833. $result = $this->checkConnectivity();
  2834. if ($result !== true) {
  2835. return $result;
  2836. }
  2837. if ($token) {
  2838. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2839. }
  2840. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2841. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2842. $data = json_decode($json, true);
  2843. return $data['resources']['core'];
  2844. }
  2845. private function checkDiskSpace($config)
  2846. {
  2847. $minSpaceFree = 1024 * 1024;
  2848. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2849. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2850. ) {
  2851. return '<error>The disk hosting '.$dir.' is full</error>';
  2852. }
  2853. return true;
  2854. }
  2855. private function checkPubKeys($config)
  2856. {
  2857. $home = $config->get('home');
  2858. $errors = array();
  2859. $io = $this->getIO();
  2860. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2861. $io->write('');
  2862. }
  2863. if (file_exists($home.'/keys.tags.pub')) {
  2864. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2865. } else {
  2866. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2867. }
  2868. if (file_exists($home.'/keys.dev.pub')) {
  2869. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2870. } else {
  2871. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2872. }
  2873. if ($errors) {
  2874. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2875. }
  2876. return $errors ?: true;
  2877. }
  2878. private function checkVersion($config)
  2879. {
  2880. $result = $this->checkConnectivity();
  2881. if ($result !== true) {
  2882. return $result;
  2883. }
  2884. $versionsUtil = new Versions($config, $this->rfs);
  2885. $latest = $versionsUtil->getLatest();
  2886. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2887. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2888. }
  2889. return true;
  2890. }
  2891. private function outputResult($result)
  2892. {
  2893. $io = $this->getIO();
  2894. if (true === $result) {
  2895. $io->write('<info>OK</info>');
  2896. return;
  2897. }
  2898. $hadError = false;
  2899. $hadWarning = false;
  2900. if ($result instanceof \Exception) {
  2901. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2902. }
  2903. if (!$result) {
  2904. $hadError = true;
  2905. } else {
  2906. if (!is_array($result)) {
  2907. $result = array($result);
  2908. }
  2909. foreach ($result as $message) {
  2910. if (false !== strpos($message, '<error>')) {
  2911. $hadError = true;
  2912. } elseif (false !== strpos($message, '<warning>')) {
  2913. $hadWarning = true;
  2914. }
  2915. }
  2916. }
  2917. if ($hadError) {
  2918. $io->write('<error>FAIL</error>');
  2919. $this->exitCode = max($this->exitCode, 2);
  2920. } elseif ($hadWarning) {
  2921. $io->write('<warning>WARNING</warning>');
  2922. $this->exitCode = max($this->exitCode, 1);
  2923. }
  2924. if ($result) {
  2925. foreach ($result as $message) {
  2926. $io->write($message);
  2927. }
  2928. }
  2929. }
  2930. private function checkPlatform()
  2931. {
  2932. $output = '';
  2933. $out = function ($msg, $style) use (&$output) {
  2934. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2935. };
  2936. $errors = array();
  2937. $warnings = array();
  2938. $displayIniMessage = false;
  2939. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2940. $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.';
  2941. if (!function_exists('json_decode')) {
  2942. $errors['json'] = true;
  2943. }
  2944. if (!extension_loaded('Phar')) {
  2945. $errors['phar'] = true;
  2946. }
  2947. if (!extension_loaded('filter')) {
  2948. $errors['filter'] = true;
  2949. }
  2950. if (!extension_loaded('hash')) {
  2951. $errors['hash'] = true;
  2952. }
  2953. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2954. $errors['iconv_mbstring'] = true;
  2955. }
  2956. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  2957. $errors['allow_url_fopen'] = true;
  2958. }
  2959. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2960. $errors['ioncube'] = ioncube_loader_version();
  2961. }
  2962. if (PHP_VERSION_ID < 50302) {
  2963. $errors['php'] = PHP_VERSION;
  2964. }
  2965. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2966. $warnings['php'] = PHP_VERSION;
  2967. }
  2968. if (!extension_loaded('openssl')) {
  2969. $errors['openssl'] = true;
  2970. }
  2971. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2972. $warnings['openssl_version'] = true;
  2973. }
  2974. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  2975. $warnings['apc_cli'] = true;
  2976. }
  2977. if (!extension_loaded('zlib')) {
  2978. $warnings['zlib'] = true;
  2979. }
  2980. ob_start();
  2981. phpinfo(INFO_GENERAL);
  2982. $phpinfo = ob_get_clean();
  2983. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2984. $configure = $match[1];
  2985. if (false !== strpos($configure, '--enable-sigchild')) {
  2986. $warnings['sigchild'] = true;
  2987. }
  2988. if (false !== strpos($configure, '--with-curlwrappers')) {
  2989. $warnings['curlwrappers'] = true;
  2990. }
  2991. }
  2992. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  2993. $warnings['xdebug_profile'] = true;
  2994. } elseif (extension_loaded('xdebug')) {
  2995. $warnings['xdebug_loaded'] = true;
  2996. }
  2997. if (!empty($errors)) {
  2998. foreach ($errors as $error => $current) {
  2999. switch ($error) {
  3000. case 'json':
  3001. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3002. $text .= "Install it or recompile php without --disable-json";
  3003. break;
  3004. case 'phar':
  3005. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3006. $text .= "Install it or recompile php without --disable-phar";
  3007. break;
  3008. case 'filter':
  3009. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3010. $text .= "Install it or recompile php without --disable-filter";
  3011. break;
  3012. case 'hash':
  3013. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3014. $text .= "Install it or recompile php without --disable-hash";
  3015. break;
  3016. case 'iconv_mbstring':
  3017. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3018. $text .= "Install either of them or recompile php without --disable-iconv";
  3019. break;
  3020. case 'unicode':
  3021. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3022. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3023. $text .= " detect_unicode = Off";
  3024. $displayIniMessage = true;
  3025. break;
  3026. case 'suhosin':
  3027. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3028. $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;
  3029. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3030. $displayIniMessage = true;
  3031. break;
  3032. case 'php':
  3033. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3034. break;
  3035. case 'allow_url_fopen':
  3036. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3037. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3038. $text .= " allow_url_fopen = On";
  3039. $displayIniMessage = true;
  3040. break;
  3041. case 'ioncube':
  3042. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3043. $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;
  3044. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3045. $displayIniMessage = true;
  3046. break;
  3047. case 'openssl':
  3048. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3049. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3050. break;
  3051. }
  3052. $out($text, 'error');
  3053. }
  3054. $output .= PHP_EOL;
  3055. }
  3056. if (!empty($warnings)) {
  3057. foreach ($warnings as $warning => $current) {
  3058. switch ($warning) {
  3059. case 'apc_cli':
  3060. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3061. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3062. $text .= " apc.enable_cli = Off";
  3063. $displayIniMessage = true;
  3064. break;
  3065. case 'zlib':
  3066. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3067. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3068. $displayIniMessage = true;
  3069. break;
  3070. case 'sigchild':
  3071. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3072. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3073. $text .= " https://bugs.php.net/bug.php?id=22999";
  3074. break;
  3075. case 'curlwrappers':
  3076. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3077. $text .= " Recompile it without this flag if possible";
  3078. break;
  3079. case 'php':
  3080. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3081. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3082. break;
  3083. case 'openssl_version':
  3084. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3085. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3086. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3087. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3088. break;
  3089. case 'xdebug_loaded':
  3090. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3091. $text .= " Disabling it when using Composer is recommended.";
  3092. break;
  3093. case 'xdebug_profile':
  3094. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3095. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3096. $text .= " xdebug.profiler_enabled = 0";
  3097. $displayIniMessage = true;
  3098. break;
  3099. }
  3100. $out($text, 'comment');
  3101. }
  3102. }
  3103. if ($displayIniMessage) {
  3104. $out($iniMessage, 'comment');
  3105. }
  3106. return !$warnings && !$errors ? true : $output;
  3107. }
  3108. private function checkConnectivity()
  3109. {
  3110. if (!ini_get('allow_url_fopen')) {
  3111. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3112. return $result;
  3113. }
  3114. return true;
  3115. }
  3116. }
  3117. <?php
  3118. namespace Composer\Command;
  3119. use Composer\Plugin\CommandEvent;
  3120. use Composer\Plugin\PluginEvents;
  3121. use Symfony\Component\Console\Input\InputInterface;
  3122. use Symfony\Component\Console\Input\InputOption;
  3123. use Symfony\Component\Console\Output\OutputInterface;
  3124. class DumpAutoloadCommand extends BaseCommand
  3125. {
  3126. protected function configure()
  3127. {
  3128. $this
  3129. ->setName('dump-autoload')
  3130. ->setAliases(array('dumpautoload'))
  3131. ->setDescription('Dumps the autoloader.')
  3132. ->setDefinition(array(
  3133. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3134. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3135. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3136. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3137. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3138. ))
  3139. ->setHelp(
  3140. <<<EOT
  3141. <info>php composer.phar dump-autoload</info>
  3142. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3143. EOT
  3144. )
  3145. ;
  3146. }
  3147. protected function execute(InputInterface $input, OutputInterface $output)
  3148. {
  3149. $composer = $this->getComposer();
  3150. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3151. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3152. $installationManager = $composer->getInstallationManager();
  3153. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3154. $package = $composer->getPackage();
  3155. $config = $composer->getConfig();
  3156. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3157. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3158. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3159. if ($authoritative) {
  3160. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>', false);
  3161. } elseif ($optimize) {
  3162. $this->getIO()->writeError('<info>Generating optimized autoload files</info>', false);
  3163. } else {
  3164. $this->getIO()->writeError('<info>Generating autoload files</info>', false);
  3165. }
  3166. $generator = $composer->getAutoloadGenerator();
  3167. $generator->setDevMode(!$input->getOption('no-dev'));
  3168. $generator->setClassMapAuthoritative($authoritative);
  3169. $generator->setApcu($apcu);
  3170. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3171. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3172. if ($authoritative) {
  3173. $this->getIO()->overwriteError('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3174. } elseif ($optimize) {
  3175. $this->getIO()->overwriteError('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3176. } else {
  3177. $this->getIO()->overwriteError('<info>Generated autoload files containing '. $numberOfClasses .' classes</info>');
  3178. }
  3179. }
  3180. }
  3181. <?php
  3182. namespace Composer\Command;
  3183. use Symfony\Component\Console\Input\InputInterface;
  3184. use Symfony\Component\Console\Input\InputOption;
  3185. use Symfony\Component\Console\Output\OutputInterface;
  3186. use Symfony\Component\Console\Input\InputArgument;
  3187. class ExecCommand extends BaseCommand
  3188. {
  3189. protected function configure()
  3190. {
  3191. $this
  3192. ->setName('exec')
  3193. ->setDescription('Executes a vendored binary/script.')
  3194. ->setDefinition(array(
  3195. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3196. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3197. new InputArgument(
  3198. 'args',
  3199. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3200. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3201. ),
  3202. ))
  3203. ->setHelp(
  3204. <<<EOT
  3205. Executes a vendored binary/script.
  3206. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3207. EOT
  3208. )
  3209. ;
  3210. }
  3211. protected function execute(InputInterface $input, OutputInterface $output)
  3212. {
  3213. $composer = $this->getComposer();
  3214. $binDir = $composer->getConfig()->get('bin-dir');
  3215. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3216. $bins = glob($binDir . '/*');
  3217. $bins = array_merge($bins, array_map(function ($e) {
  3218. return "$e (local)";
  3219. }, $composer->getPackage()->getBinaries()));
  3220. if (!$bins) {
  3221. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3222. }
  3223. $this->getIO()->write(
  3224. <<<EOT
  3225. <comment>Available binaries:</comment>
  3226. EOT
  3227. );
  3228. foreach ($bins as $bin) {
  3229. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3230. continue;
  3231. }
  3232. $previousBin = $bin;
  3233. $bin = basename($bin);
  3234. $this->getIO()->write(
  3235. <<<EOT
  3236. <info>- $bin</info>
  3237. EOT
  3238. );
  3239. }
  3240. return 0;
  3241. }
  3242. $binary = $input->getArgument('binary');
  3243. $dispatcher = $composer->getEventDispatcher();
  3244. $dispatcher->addListener('__exec_command', $binary);
  3245. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3246. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3247. }
  3248. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3249. }
  3250. }
  3251. <?php
  3252. namespace Composer\Command;
  3253. use Composer\Factory;
  3254. use Composer\Util\Filesystem;
  3255. use Symfony\Component\Console\Input\InputInterface;
  3256. use Symfony\Component\Console\Input\InputArgument;
  3257. use Symfony\Component\Console\Input\StringInput;
  3258. use Symfony\Component\Console\Output\OutputInterface;
  3259. class GlobalCommand extends BaseCommand
  3260. {
  3261. protected function configure()
  3262. {
  3263. $this
  3264. ->setName('global')
  3265. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3266. ->setDefinition(array(
  3267. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3268. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3269. ))
  3270. ->setHelp(
  3271. <<<EOT
  3272. Use this command as a wrapper to run other Composer commands
  3273. within the global context of COMPOSER_HOME.
  3274. You can use this to install CLI utilities globally, all you need
  3275. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3276. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3277. and /home/<user>/.composer on unix systems.
  3278. If your system uses freedesktop.org standards, then it will first check
  3279. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3280. Note: This path may vary depending on customizations to bin-dir in
  3281. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3282. Read more at https://getcomposer.org/doc/03-cli.md#global
  3283. EOT
  3284. )
  3285. ;
  3286. }
  3287. public function run(InputInterface $input, OutputInterface $output)
  3288. {
  3289. $tokens = preg_split('{\s+}', $input->__toString());
  3290. $args = array();
  3291. foreach ($tokens as $token) {
  3292. if ($token && $token[0] !== '-') {
  3293. $args[] = $token;
  3294. if (count($args) >= 2) {
  3295. break;
  3296. }
  3297. }
  3298. }
  3299. if (count($args) < 2) {
  3300. return parent::run($input, $output);
  3301. }
  3302. $config = Factory::createConfig();
  3303. $home = $config->get('home');
  3304. if (!is_dir($home)) {
  3305. $fs = new Filesystem();
  3306. $fs->ensureDirectoryExists($home);
  3307. if (!is_dir($home)) {
  3308. throw new \RuntimeException('Could not create home directory');
  3309. }
  3310. }
  3311. try {
  3312. chdir($home);
  3313. } catch (\Exception $e) {
  3314. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3315. }
  3316. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3317. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3318. $this->getApplication()->resetComposer();
  3319. return $this->getApplication()->run($input, $output);
  3320. }
  3321. public function isProxyCommand()
  3322. {
  3323. return true;
  3324. }
  3325. }
  3326. <?php
  3327. namespace Composer\Command;
  3328. use Composer\Package\CompletePackageInterface;
  3329. use Composer\Repository\RepositoryInterface;
  3330. use Composer\Repository\ArrayRepository;
  3331. use Composer\Repository\RepositoryFactory;
  3332. use Composer\Util\Platform;
  3333. use Composer\Util\ProcessExecutor;
  3334. use Symfony\Component\Console\Input\InputArgument;
  3335. use Symfony\Component\Console\Input\InputOption;
  3336. use Symfony\Component\Console\Input\InputInterface;
  3337. use Symfony\Component\Console\Output\OutputInterface;
  3338. class HomeCommand extends BaseCommand
  3339. {
  3340. protected function configure()
  3341. {
  3342. $this
  3343. ->setName('browse')
  3344. ->setAliases(array('home'))
  3345. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3346. ->setDefinition(array(
  3347. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3348. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3349. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3350. ))
  3351. ->setHelp(
  3352. <<<EOT
  3353. The home command opens or shows a package's repository URL or
  3354. homepage in your default browser.
  3355. To open the homepage by default, use -H or --homepage.
  3356. To show instead of open the repository or homepage URL, use -s or --show.
  3357. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3358. EOT
  3359. );
  3360. }
  3361. protected function execute(InputInterface $input, OutputInterface $output)
  3362. {
  3363. $repos = $this->initializeRepos();
  3364. $io = $this->getIO();
  3365. $return = 0;
  3366. $packages = $input->getArgument('packages');
  3367. if (!$packages) {
  3368. $io->writeError('No package specified, opening homepage for the root package');
  3369. $packages = array($this->getComposer()->getPackage()->getName());
  3370. }
  3371. foreach ($packages as $packageName) {
  3372. $handled = false;
  3373. $packageExists = false;
  3374. foreach ($repos as $repo) {
  3375. foreach ($repo->findPackages($packageName) as $package) {
  3376. $packageExists = true;
  3377. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3378. $handled = true;
  3379. break 2;
  3380. }
  3381. }
  3382. }
  3383. if (!$packageExists) {
  3384. $return = 1;
  3385. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3386. }
  3387. if (!$handled) {
  3388. $return = 1;
  3389. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3390. }
  3391. }
  3392. return $return;
  3393. }
  3394. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3395. {
  3396. $support = $package->getSupport();
  3397. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3398. if (!$url || $showHomepage) {
  3399. $url = $package->getHomepage();
  3400. }
  3401. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3402. return false;
  3403. }
  3404. if ($showOnly) {
  3405. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3406. } else {
  3407. $this->openBrowser($url);
  3408. }
  3409. return true;
  3410. }
  3411. private function openBrowser($url)
  3412. {
  3413. $url = ProcessExecutor::escape($url);
  3414. $process = new ProcessExecutor($this->getIO());
  3415. if (Platform::isWindows()) {
  3416. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3417. }
  3418. $linux = $process->execute('which xdg-open', $output);
  3419. $osx = $process->execute('which open', $output);
  3420. if (0 === $linux) {
  3421. $process->execute('xdg-open ' . $url, $output);
  3422. } elseif (0 === $osx) {
  3423. $process->execute('open ' . $url, $output);
  3424. } else {
  3425. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3426. }
  3427. }
  3428. private function initializeRepos()
  3429. {
  3430. $composer = $this->getComposer(false);
  3431. if ($composer) {
  3432. return array_merge(
  3433. array(new ArrayRepository(array($composer->getPackage()))),
  3434. array($composer->getRepositoryManager()->getLocalRepository()),
  3435. $composer->getRepositoryManager()->getRepositories()
  3436. );
  3437. }
  3438. return RepositoryFactory::defaultRepos($this->getIO());
  3439. }
  3440. }
  3441. <?php
  3442. namespace Composer\Command;
  3443. use Composer\DependencyResolver\Pool;
  3444. use Composer\Factory;
  3445. use Composer\Json\JsonFile;
  3446. use Composer\Package\BasePackage;
  3447. use Composer\Package\Version\VersionParser;
  3448. use Composer\Package\Version\VersionSelector;
  3449. use Composer\Repository\CompositeRepository;
  3450. use Composer\Repository\PlatformRepository;
  3451. use Composer\Repository\RepositoryFactory;
  3452. use Composer\Util\ProcessExecutor;
  3453. use Symfony\Component\Console\Input\ArrayInput;
  3454. use Symfony\Component\Console\Input\InputInterface;
  3455. use Symfony\Component\Console\Input\InputOption;
  3456. use Symfony\Component\Console\Output\OutputInterface;
  3457. use Symfony\Component\Process\ExecutableFinder;
  3458. use Symfony\Component\Process\Process;
  3459. class InitCommand extends BaseCommand
  3460. {
  3461. protected $repos;
  3462. private $gitConfig;
  3463. private $pools;
  3464. protected function configure()
  3465. {
  3466. $this
  3467. ->setName('init')
  3468. ->setDescription('Creates a basic composer.json file in current directory.')
  3469. ->setDefinition(array(
  3470. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3471. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3472. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3473. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3474. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3475. 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"'),
  3476. 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"'),
  3477. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3478. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3479. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3480. ))
  3481. ->setHelp(
  3482. <<<EOT
  3483. The <info>init</info> command creates a basic composer.json file
  3484. in the current directory.
  3485. <info>php composer.phar init</info>
  3486. Read more at https://getcomposer.org/doc/03-cli.md#init
  3487. EOT
  3488. )
  3489. ;
  3490. }
  3491. protected function execute(InputInterface $input, OutputInterface $output)
  3492. {
  3493. $io = $this->getIO();
  3494. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3495. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3496. if (isset($options['author'])) {
  3497. $options['authors'] = $this->formatAuthors($options['author']);
  3498. unset($options['author']);
  3499. }
  3500. $repositories = $input->getOption('repository');
  3501. if ($repositories) {
  3502. $config = Factory::createConfig($io);
  3503. foreach ($repositories as $repo) {
  3504. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3505. }
  3506. }
  3507. if (isset($options['stability'])) {
  3508. $options['minimum-stability'] = $options['stability'];
  3509. unset($options['stability']);
  3510. }
  3511. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3512. if (array() === $options['require']) {
  3513. $options['require'] = new \stdClass;
  3514. }
  3515. if (isset($options['require-dev'])) {
  3516. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3517. if (array() === $options['require-dev']) {
  3518. $options['require-dev'] = new \stdClass;
  3519. }
  3520. }
  3521. $file = new JsonFile(Factory::getComposerFile());
  3522. $json = $file->encode($options);
  3523. if ($input->isInteractive()) {
  3524. $io->writeError(array('', $json, ''));
  3525. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3526. $io->writeError('<error>Command aborted</error>');
  3527. return 1;
  3528. }
  3529. }
  3530. $file->write($options);
  3531. if ($input->isInteractive() && is_dir('.git')) {
  3532. $ignoreFile = realpath('.gitignore');
  3533. if (false === $ignoreFile) {
  3534. $ignoreFile = realpath('.') . '/.gitignore';
  3535. }
  3536. if (!$this->hasVendorIgnore($ignoreFile)) {
  3537. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3538. if ($io->askConfirmation($question, true)) {
  3539. $this->addVendorIgnore($ignoreFile);
  3540. }
  3541. }
  3542. }
  3543. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3544. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3545. $this->installDependencies($output);
  3546. }
  3547. }
  3548. protected function interact(InputInterface $input, OutputInterface $output)
  3549. {
  3550. $git = $this->getGitConfig();
  3551. $io = $this->getIO();
  3552. $formatter = $this->getHelperSet()->get('formatter');
  3553. $repositories = $input->getOption('repository');
  3554. if ($repositories) {
  3555. $config = Factory::createConfig($io);
  3556. $repos = array(new PlatformRepository);
  3557. $createDefaultPackagistRepo = true;
  3558. foreach ($repositories as $repo) {
  3559. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3560. if (
  3561. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3562. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3563. ) {
  3564. $createDefaultPackagistRepo = false;
  3565. continue;
  3566. }
  3567. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3568. }
  3569. if ($createDefaultPackagistRepo) {
  3570. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3571. 'type' => 'composer',
  3572. 'url' => 'https://repo.packagist.org',
  3573. ));
  3574. }
  3575. $this->repos = new CompositeRepository($repos);
  3576. unset($repos, $config, $repositories);
  3577. }
  3578. $io->writeError(array(
  3579. '',
  3580. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3581. '',
  3582. ));
  3583. $io->writeError(array(
  3584. '',
  3585. 'This command will guide you through creating your composer.json config.',
  3586. '',
  3587. ));
  3588. $cwd = realpath(".");
  3589. if (!$name = $input->getOption('name')) {
  3590. $name = basename($cwd);
  3591. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3592. $name = strtolower($name);
  3593. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3594. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3595. } elseif (isset($git['github.user'])) {
  3596. $name = $git['github.user'] . '/' . $name;
  3597. } elseif (!empty($_SERVER['USERNAME'])) {
  3598. $name = $_SERVER['USERNAME'] . '/' . $name;
  3599. } elseif (!empty($_SERVER['USER'])) {
  3600. $name = $_SERVER['USER'] . '/' . $name;
  3601. } elseif (get_current_user()) {
  3602. $name = get_current_user() . '/' . $name;
  3603. } else {
  3604. $name .= '/' . $name;
  3605. }
  3606. $name = strtolower($name);
  3607. } else {
  3608. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3609. throw new \InvalidArgumentException(
  3610. '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_.-]+'
  3611. );
  3612. }
  3613. }
  3614. $name = $io->askAndValidate(
  3615. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3616. function ($value) use ($name) {
  3617. if (null === $value) {
  3618. return $name;
  3619. }
  3620. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3621. throw new \InvalidArgumentException(
  3622. '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_.-]+'
  3623. );
  3624. }
  3625. return $value;
  3626. },
  3627. null,
  3628. $name
  3629. );
  3630. $input->setOption('name', $name);
  3631. $description = $input->getOption('description') ?: false;
  3632. $description = $io->ask(
  3633. 'Description [<comment>'.$description.'</comment>]: ',
  3634. $description
  3635. );
  3636. $input->setOption('description', $description);
  3637. if (null === $author = $input->getOption('author')) {
  3638. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3639. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3640. } elseif (isset($git['user.name'])) {
  3641. $author_name = $git['user.name'];
  3642. }
  3643. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3644. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3645. } elseif (isset($git['user.email'])) {
  3646. $author_email = $git['user.email'];
  3647. }
  3648. if (isset($author_name) && isset($author_email)) {
  3649. $author = sprintf('%s <%s>', $author_name, $author_email);
  3650. }
  3651. }
  3652. $self = $this;
  3653. $author = $io->askAndValidate(
  3654. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3655. function ($value) use ($self, $author) {
  3656. if ($value === 'n' || $value === 'no') {
  3657. return;
  3658. }
  3659. $value = $value ?: $author;
  3660. $author = $self->parseAuthorString($value);
  3661. return sprintf('%s <%s>', $author['name'], $author['email']);
  3662. },
  3663. null,
  3664. $author
  3665. );
  3666. $input->setOption('author', $author);
  3667. $minimumStability = $input->getOption('stability') ?: null;
  3668. $minimumStability = $io->askAndValidate(
  3669. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3670. function ($value) use ($minimumStability) {
  3671. if (null === $value) {
  3672. return $minimumStability;
  3673. }
  3674. if (!isset(BasePackage::$stabilities[$value])) {
  3675. throw new \InvalidArgumentException(
  3676. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3677. implode(', ', array_keys(BasePackage::$stabilities))
  3678. );
  3679. }
  3680. return $value;
  3681. },
  3682. null,
  3683. $minimumStability
  3684. );
  3685. $input->setOption('stability', $minimumStability);
  3686. $type = $input->getOption('type') ?: false;
  3687. $type = $io->ask(
  3688. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3689. $type
  3690. );
  3691. $input->setOption('type', $type);
  3692. if (null === $license = $input->getOption('license')) {
  3693. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3694. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3695. }
  3696. }
  3697. $license = $io->ask(
  3698. 'License [<comment>'.$license.'</comment>]: ',
  3699. $license
  3700. );
  3701. $input->setOption('license', $license);
  3702. $io->writeError(array('', 'Define your dependencies.', ''));
  3703. $repos = $this->getRepos();
  3704. $preferredStability = $minimumStability ?: 'stable';
  3705. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3706. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3707. $require = $input->getOption('require');
  3708. $requirements = array();
  3709. if ($require || $io->askConfirmation($question, true)) {
  3710. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3711. }
  3712. $input->setOption('require', $requirements);
  3713. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3714. $requireDev = $input->getOption('require-dev');
  3715. $devRequirements = array();
  3716. if ($requireDev || $io->askConfirmation($question, true)) {
  3717. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3718. }
  3719. $input->setOption('require-dev', $devRequirements);
  3720. }
  3721. public function parseAuthorString($author)
  3722. {
  3723. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3724. if ($this->isValidEmail($match['email'])) {
  3725. return array(
  3726. 'name' => trim($match['name']),
  3727. 'email' => $match['email'],
  3728. );
  3729. }
  3730. }
  3731. throw new \InvalidArgumentException(
  3732. 'Invalid author string. Must be in the format: '.
  3733. 'John Smith <john@example.com>'
  3734. );
  3735. }
  3736. protected function findPackages($name)
  3737. {
  3738. return $this->getRepos()->search($name);
  3739. }
  3740. protected function getRepos()
  3741. {
  3742. if (!$this->repos) {
  3743. $this->repos = new CompositeRepository(array_merge(
  3744. array(new PlatformRepository),
  3745. RepositoryFactory::defaultRepos($this->getIO())
  3746. ));
  3747. }
  3748. return $this->repos;
  3749. }
  3750. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true)
  3751. {
  3752. if ($requires) {
  3753. $requires = $this->normalizeRequirements($requires);
  3754. $result = array();
  3755. $io = $this->getIO();
  3756. foreach ($requires as $requirement) {
  3757. if (!isset($requirement['version'])) {
  3758. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3759. $requirement['version'] = $version;
  3760. $requirement['name'] = $name;
  3761. $io->writeError(sprintf(
  3762. 'Using version <info>%s</info> for <info>%s</info>',
  3763. $requirement['version'],
  3764. $requirement['name']
  3765. ));
  3766. } else {
  3767. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev');
  3768. $requirement['name'] = $name;
  3769. }
  3770. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3771. }
  3772. return $result;
  3773. }
  3774. $versionParser = new VersionParser();
  3775. $io = $this->getIO();
  3776. while (null !== $package = $io->ask('Search for a package: ')) {
  3777. $matches = $this->findPackages($package);
  3778. if (count($matches)) {
  3779. $exactMatch = null;
  3780. $choices = array();
  3781. foreach ($matches as $position => $foundPackage) {
  3782. $abandoned = '';
  3783. if (isset($foundPackage['abandoned'])) {
  3784. if (is_string($foundPackage['abandoned'])) {
  3785. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3786. } else {
  3787. $replacement = 'No replacement was suggested';
  3788. }
  3789. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3790. }
  3791. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3792. if ($foundPackage['name'] === $package) {
  3793. $exactMatch = true;
  3794. break;
  3795. }
  3796. }
  3797. if (!$exactMatch) {
  3798. $io->writeError(array(
  3799. '',
  3800. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3801. '',
  3802. ));
  3803. $io->writeError($choices);
  3804. $io->writeError('');
  3805. $validator = function ($selection) use ($matches, $versionParser) {
  3806. if ('' === $selection) {
  3807. return false;
  3808. }
  3809. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3810. $package = $matches[(int) $selection];
  3811. return $package['name'];
  3812. }
  3813. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3814. if (isset($packageMatches['version'])) {
  3815. $versionParser->parseConstraints($packageMatches['version']);
  3816. return $packageMatches['name'].' '.$packageMatches['version'];
  3817. }
  3818. return $packageMatches['name'];
  3819. }
  3820. throw new \Exception('Not a valid selection');
  3821. };
  3822. $package = $io->askAndValidate(
  3823. 'Enter package # to add, or the complete package name if it is not listed: ',
  3824. $validator,
  3825. 3,
  3826. false
  3827. );
  3828. }
  3829. if (false !== $package && false === strpos($package, ' ')) {
  3830. $validator = function ($input) {
  3831. $input = trim($input);
  3832. return $input ?: false;
  3833. };
  3834. $constraint = $io->askAndValidate(
  3835. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3836. $validator,
  3837. 3,
  3838. false
  3839. );
  3840. if (false === $constraint) {
  3841. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3842. $io->writeError(sprintf(
  3843. 'Using version <info>%s</info> for <info>%s</info>',
  3844. $constraint,
  3845. $package
  3846. ));
  3847. }
  3848. $package .= ' '.$constraint;
  3849. }
  3850. if (false !== $package) {
  3851. $requires[] = $package;
  3852. }
  3853. }
  3854. }
  3855. return $requires;
  3856. }
  3857. protected function formatAuthors($author)
  3858. {
  3859. return array($this->parseAuthorString($author));
  3860. }
  3861. protected function formatRequirements(array $requirements)
  3862. {
  3863. $requires = array();
  3864. $requirements = $this->normalizeRequirements($requirements);
  3865. foreach ($requirements as $requirement) {
  3866. $requires[$requirement['name']] = $requirement['version'];
  3867. }
  3868. return $requires;
  3869. }
  3870. protected function getGitConfig()
  3871. {
  3872. if (null !== $this->gitConfig) {
  3873. return $this->gitConfig;
  3874. }
  3875. $finder = new ExecutableFinder();
  3876. $gitBin = $finder->find('git');
  3877. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  3878. $cmd = new Process(array($gitBin, 'config', '-l'));
  3879. } else {
  3880. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3881. }
  3882. $cmd->run();
  3883. if ($cmd->isSuccessful()) {
  3884. $this->gitConfig = array();
  3885. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3886. foreach ($matches as $match) {
  3887. $this->gitConfig[$match[1]] = $match[2];
  3888. }
  3889. return $this->gitConfig;
  3890. }
  3891. return $this->gitConfig = array();
  3892. }
  3893. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3894. {
  3895. if (!file_exists($ignoreFile)) {
  3896. return false;
  3897. }
  3898. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3899. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3900. foreach ($lines as $line) {
  3901. if (preg_match($pattern, $line)) {
  3902. return true;
  3903. }
  3904. }
  3905. return false;
  3906. }
  3907. protected function normalizeRequirements(array $requirements)
  3908. {
  3909. $parser = new VersionParser();
  3910. return $parser->parseNameVersionPairs($requirements);
  3911. }
  3912. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3913. {
  3914. $contents = "";
  3915. if (file_exists($ignoreFile)) {
  3916. $contents = file_get_contents($ignoreFile);
  3917. if ("\n" !== substr($contents, 0, -1)) {
  3918. $contents .= "\n";
  3919. }
  3920. }
  3921. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3922. }
  3923. protected function isValidEmail($email)
  3924. {
  3925. if (!function_exists('filter_var')) {
  3926. return true;
  3927. }
  3928. if (PHP_VERSION_ID < 50303) {
  3929. return true;
  3930. }
  3931. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3932. }
  3933. private function getPool(InputInterface $input, $minimumStability = null)
  3934. {
  3935. $key = $minimumStability ?: 'default';
  3936. if (!isset($this->pools[$key])) {
  3937. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3938. $pool->addRepository($this->getRepos());
  3939. }
  3940. return $this->pools[$key];
  3941. }
  3942. private function getMinimumStability(InputInterface $input)
  3943. {
  3944. if ($input->hasOption('stability')) {
  3945. return $input->getOption('stability') ?: 'stable';
  3946. }
  3947. $file = Factory::getComposerFile();
  3948. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3949. if (!empty($composer['minimum-stability'])) {
  3950. return $composer['minimum-stability'];
  3951. }
  3952. }
  3953. return 'stable';
  3954. }
  3955. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3956. {
  3957. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3958. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  3959. if ($ignorePlatformReqs) {
  3960. $phpVersion = null;
  3961. }
  3962. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3963. if (!$package) {
  3964. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  3965. return array($name, $requiredVersion ?: '*');
  3966. }
  3967. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3968. throw new \InvalidArgumentException(sprintf(
  3969. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3970. $name,
  3971. $requiredVersion,
  3972. $phpVersion
  3973. ));
  3974. }
  3975. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3976. throw new \InvalidArgumentException(sprintf(
  3977. 'Could not find package %s in a version matching %s',
  3978. $name,
  3979. $requiredVersion
  3980. ));
  3981. }
  3982. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3983. throw new \InvalidArgumentException(sprintf(
  3984. 'Could not find package %s in any version matching your PHP version (%s)',
  3985. $name,
  3986. $phpVersion
  3987. ));
  3988. }
  3989. $similar = $this->findSimilar($name);
  3990. if ($similar) {
  3991. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3992. throw new \InvalidArgumentException(sprintf(
  3993. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3994. $name,
  3995. $this->getMinimumStability($input)
  3996. ));
  3997. }
  3998. throw new \InvalidArgumentException(sprintf(
  3999. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4000. $name,
  4001. implode("\n ", $similar)
  4002. ));
  4003. }
  4004. throw new \InvalidArgumentException(sprintf(
  4005. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  4006. $name,
  4007. $this->getMinimumStability($input)
  4008. ));
  4009. }
  4010. return array(
  4011. $package->getPrettyName(),
  4012. $versionSelector->findRecommendedRequireVersion($package),
  4013. );
  4014. }
  4015. private function findSimilar($package)
  4016. {
  4017. try {
  4018. $results = $this->repos->search($package);
  4019. } catch (\Exception $e) {
  4020. return array();
  4021. }
  4022. $similarPackages = array();
  4023. foreach ($results as $result) {
  4024. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4025. }
  4026. asort($similarPackages);
  4027. return array_keys(array_slice($similarPackages, 0, 5));
  4028. }
  4029. private function installDependencies($output)
  4030. {
  4031. try {
  4032. $installCommand = $this->getApplication()->find('install');
  4033. $installCommand->run(new ArrayInput(array()), $output);
  4034. } catch (\Exception $e) {
  4035. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4036. }
  4037. }
  4038. private function hasDependencies($options)
  4039. {
  4040. $requires = (array) $options['require'];
  4041. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4042. return !empty($requires) || !empty($devRequires);
  4043. }
  4044. }
  4045. <?php
  4046. namespace Composer\Command;
  4047. use Composer\Installer;
  4048. use Composer\Plugin\CommandEvent;
  4049. use Composer\Plugin\PluginEvents;
  4050. use Symfony\Component\Console\Input\InputInterface;
  4051. use Symfony\Component\Console\Input\InputOption;
  4052. use Symfony\Component\Console\Input\InputArgument;
  4053. use Symfony\Component\Console\Output\OutputInterface;
  4054. class InstallCommand extends BaseCommand
  4055. {
  4056. protected function configure()
  4057. {
  4058. $this
  4059. ->setName('install')
  4060. ->setAliases(array('i'))
  4061. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4062. ->setDefinition(array(
  4063. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4064. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4065. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4066. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4067. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4068. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4069. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4070. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4071. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4072. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4073. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4074. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4075. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4076. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4077. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4078. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4079. ))
  4080. ->setHelp(
  4081. <<<EOT
  4082. The <info>install</info> command reads the composer.lock file from
  4083. the current directory, processes it, and downloads and installs all the
  4084. libraries and dependencies outlined in that file. If the file does not
  4085. exist it will look for composer.json and do the same.
  4086. <info>php composer.phar install</info>
  4087. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4088. EOT
  4089. )
  4090. ;
  4091. }
  4092. protected function execute(InputInterface $input, OutputInterface $output)
  4093. {
  4094. $io = $this->getIO();
  4095. if ($args = $input->getArgument('packages')) {
  4096. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4097. return 1;
  4098. }
  4099. if ($input->getOption('no-custom-installers')) {
  4100. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4101. $input->setOption('no-plugins', true);
  4102. }
  4103. if ($input->getOption('dev')) {
  4104. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4105. }
  4106. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4107. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4108. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4109. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4110. $install = Installer::create($io, $composer);
  4111. $config = $composer->getConfig();
  4112. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4113. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4114. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4115. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4116. $install
  4117. ->setDryRun($input->getOption('dry-run'))
  4118. ->setVerbose($input->getOption('verbose'))
  4119. ->setPreferSource($preferSource)
  4120. ->setPreferDist($preferDist)
  4121. ->setDevMode(!$input->getOption('no-dev'))
  4122. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4123. ->setRunScripts(!$input->getOption('no-scripts'))
  4124. ->setSkipSuggest($input->getOption('no-suggest'))
  4125. ->setOptimizeAutoloader($optimize)
  4126. ->setClassMapAuthoritative($authoritative)
  4127. ->setApcuAutoloader($apcu)
  4128. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4129. ;
  4130. if ($input->getOption('no-plugins')) {
  4131. $install->disablePlugins();
  4132. }
  4133. return $install->run();
  4134. }
  4135. }
  4136. <?php
  4137. namespace Composer\Command;
  4138. use Composer\Json\JsonFile;
  4139. use Composer\Plugin\CommandEvent;
  4140. use Composer\Plugin\PluginEvents;
  4141. use Composer\Package\PackageInterface;
  4142. use Composer\Repository\RepositoryInterface;
  4143. use Symfony\Component\Console\Helper\Table;
  4144. use Symfony\Component\Console\Input\InputInterface;
  4145. use Symfony\Component\Console\Input\InputOption;
  4146. use Symfony\Component\Console\Output\OutputInterface;
  4147. class LicensesCommand extends BaseCommand
  4148. {
  4149. protected function configure()
  4150. {
  4151. $this
  4152. ->setName('licenses')
  4153. ->setDescription('Shows information about licenses of dependencies.')
  4154. ->setDefinition(array(
  4155. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4156. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4157. ))
  4158. ->setHelp(
  4159. <<<EOT
  4160. The license command displays detailed information about the licenses of
  4161. the installed dependencies.
  4162. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4163. EOT
  4164. )
  4165. ;
  4166. }
  4167. protected function execute(InputInterface $input, OutputInterface $output)
  4168. {
  4169. $composer = $this->getComposer();
  4170. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4171. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4172. $root = $composer->getPackage();
  4173. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4174. if ($input->getOption('no-dev')) {
  4175. $packages = $this->filterRequiredPackages($repo, $root);
  4176. } else {
  4177. $packages = $this->appendPackages($repo->getPackages(), array());
  4178. }
  4179. ksort($packages);
  4180. $io = $this->getIO();
  4181. switch ($format = $input->getOption('format')) {
  4182. case 'text':
  4183. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4184. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4185. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4186. $io->write('Dependencies:');
  4187. $io->write('');
  4188. $table = new Table($output);
  4189. $table->setStyle('compact');
  4190. $tableStyle = $table->getStyle();
  4191. $tableStyle->setVerticalBorderChar('');
  4192. $tableStyle->setCellRowContentFormat('%s ');
  4193. $table->setHeaders(array('Name', 'Version', 'License'));
  4194. foreach ($packages as $package) {
  4195. $table->addRow(array(
  4196. $package->getPrettyName(),
  4197. $package->getFullPrettyVersion(),
  4198. implode(', ', $package->getLicense()) ?: 'none',
  4199. ));
  4200. }
  4201. $table->render();
  4202. break;
  4203. case 'json':
  4204. $dependencies = array();
  4205. foreach ($packages as $package) {
  4206. $dependencies[$package->getPrettyName()] = array(
  4207. 'version' => $package->getFullPrettyVersion(),
  4208. 'license' => $package->getLicense(),
  4209. );
  4210. }
  4211. $io->write(JsonFile::encode(array(
  4212. 'name' => $root->getPrettyName(),
  4213. 'version' => $root->getFullPrettyVersion(),
  4214. 'license' => $root->getLicense(),
  4215. 'dependencies' => $dependencies,
  4216. )));
  4217. break;
  4218. default:
  4219. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4220. }
  4221. }
  4222. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4223. {
  4224. $requires = array_keys($package->getRequires());
  4225. $packageListNames = array_keys($bucket);
  4226. $packages = array_filter(
  4227. $repo->getPackages(),
  4228. function ($package) use ($requires, $packageListNames) {
  4229. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4230. }
  4231. );
  4232. $bucket = $this->appendPackages($packages, $bucket);
  4233. foreach ($packages as $package) {
  4234. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4235. }
  4236. return $bucket;
  4237. }
  4238. public function appendPackages(array $packages, array $bucket)
  4239. {
  4240. foreach ($packages as $package) {
  4241. $bucket[$package->getName()] = $package;
  4242. }
  4243. return $bucket;
  4244. }
  4245. }
  4246. <?php
  4247. namespace Composer\Command;
  4248. use Symfony\Component\Console\Input\InputInterface;
  4249. use Symfony\Component\Console\Input\InputArgument;
  4250. use Symfony\Component\Console\Input\ArrayInput;
  4251. use Symfony\Component\Console\Input\InputOption;
  4252. use Symfony\Component\Console\Output\OutputInterface;
  4253. class OutdatedCommand extends ShowCommand
  4254. {
  4255. protected function configure()
  4256. {
  4257. $this
  4258. ->setName('outdated')
  4259. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4260. ->setDefinition(array(
  4261. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4262. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4263. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4264. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4265. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4266. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4267. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4268. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4269. ))
  4270. ->setHelp(
  4271. <<<EOT
  4272. The outdated command is just a proxy for `composer show -l`
  4273. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4274. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4275. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4276. compatibility breaks according to semver, so upgrade when you can but it
  4277. may involve work.
  4278. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4279. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4280. EOT
  4281. )
  4282. ;
  4283. }
  4284. protected function execute(InputInterface $input, OutputInterface $output)
  4285. {
  4286. $args = array(
  4287. 'show',
  4288. '--latest' => true,
  4289. );
  4290. if (!$input->getOption('all')) {
  4291. $args['--outdated'] = true;
  4292. }
  4293. if ($input->getOption('direct')) {
  4294. $args['--direct'] = true;
  4295. }
  4296. if ($input->getArgument('package')) {
  4297. $args['package'] = $input->getArgument('package');
  4298. }
  4299. if ($input->getOption('strict')) {
  4300. $args['--strict'] = true;
  4301. }
  4302. if ($input->getOption('minor-only')) {
  4303. $args['--minor-only'] = true;
  4304. }
  4305. $args['--format'] = $input->getOption('format');
  4306. $args['--ignore'] = $input->getOption('ignore');
  4307. $input = new ArrayInput($args);
  4308. return $this->getApplication()->run($input, $output);
  4309. }
  4310. public function isProxyCommand()
  4311. {
  4312. return true;
  4313. }
  4314. }
  4315. <?php
  4316. namespace Composer\Command;
  4317. use Symfony\Component\Console\Input\InputInterface;
  4318. use Symfony\Component\Console\Output\OutputInterface;
  4319. class ProhibitsCommand extends BaseDependencyCommand
  4320. {
  4321. protected function configure()
  4322. {
  4323. parent::configure();
  4324. $this
  4325. ->setName('prohibits')
  4326. ->setAliases(array('why-not'))
  4327. ->setDescription('Shows which packages prevent the given package from being installed.')
  4328. ->setHelp(
  4329. <<<EOT
  4330. Displays detailed information about why a package cannot be installed.
  4331. <info>php composer.phar prohibits composer/composer</info>
  4332. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4333. EOT
  4334. )
  4335. ;
  4336. }
  4337. protected function execute(InputInterface $input, OutputInterface $output)
  4338. {
  4339. return parent::doExecute($input, $output, true);
  4340. }
  4341. }
  4342. <?php
  4343. namespace Composer\Command;
  4344. use Composer\Config\JsonConfigSource;
  4345. use Composer\Installer;
  4346. use Composer\Plugin\CommandEvent;
  4347. use Composer\Plugin\PluginEvents;
  4348. use Composer\Json\JsonFile;
  4349. use Composer\Factory;
  4350. use Symfony\Component\Console\Input\InputInterface;
  4351. use Symfony\Component\Console\Input\InputOption;
  4352. use Symfony\Component\Console\Input\InputArgument;
  4353. use Symfony\Component\Console\Output\OutputInterface;
  4354. use Composer\Package\BasePackage;
  4355. class RemoveCommand extends BaseCommand
  4356. {
  4357. protected function configure()
  4358. {
  4359. $this
  4360. ->setName('remove')
  4361. ->setDescription('Removes a package from the require or require-dev.')
  4362. ->setDefinition(array(
  4363. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4364. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4365. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4366. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4367. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4368. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4369. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4370. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4371. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4372. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4373. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4374. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4375. ))
  4376. ->setHelp(
  4377. <<<EOT
  4378. The <info>remove</info> command removes a package from the current
  4379. list of installed packages
  4380. <info>php composer.phar remove</info>
  4381. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4382. EOT
  4383. )
  4384. ;
  4385. }
  4386. protected function execute(InputInterface $input, OutputInterface $output)
  4387. {
  4388. $packages = $input->getArgument('packages');
  4389. $packages = array_map('strtolower', $packages);
  4390. $file = Factory::getComposerFile();
  4391. $jsonFile = new JsonFile($file);
  4392. $composer = $jsonFile->read();
  4393. $composerBackup = file_get_contents($jsonFile->getPath());
  4394. $json = new JsonConfigSource($jsonFile);
  4395. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4396. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4397. $io = $this->getIO();
  4398. if ($input->getOption('update-with-dependencies')) {
  4399. $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>');
  4400. }
  4401. foreach (array('require', 'require-dev') as $linkType) {
  4402. if (isset($composer[$linkType])) {
  4403. foreach ($composer[$linkType] as $name => $version) {
  4404. $composer[$linkType][strtolower($name)] = $name;
  4405. }
  4406. }
  4407. }
  4408. foreach ($packages as $package) {
  4409. if (isset($composer[$type][$package])) {
  4410. $json->removeLink($type, $composer[$type][$package]);
  4411. } elseif (isset($composer[$altType][$package])) {
  4412. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4413. if ($io->isInteractive()) {
  4414. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4415. $json->removeLink($altType, $composer[$altType][$package]);
  4416. }
  4417. }
  4418. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4419. foreach ($matches as $matchedPackage) {
  4420. $json->removeLink($type, $matchedPackage);
  4421. }
  4422. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4423. foreach ($matches as $matchedPackage) {
  4424. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4425. if ($io->isInteractive()) {
  4426. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4427. $json->removeLink($altType, $matchedPackage);
  4428. }
  4429. }
  4430. }
  4431. } else {
  4432. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4433. }
  4434. }
  4435. if ($input->getOption('no-update')) {
  4436. return 0;
  4437. }
  4438. $this->resetComposer();
  4439. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4440. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4441. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4442. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4443. $install = Installer::create($io, $composer);
  4444. $updateDevMode = !$input->getOption('update-no-dev');
  4445. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4446. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4447. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4448. $install
  4449. ->setVerbose($input->getOption('verbose'))
  4450. ->setDevMode($updateDevMode)
  4451. ->setOptimizeAutoloader($optimize)
  4452. ->setClassMapAuthoritative($authoritative)
  4453. ->setApcuAutoloader($apcu)
  4454. ->setUpdate(true)
  4455. ->setUpdateWhitelist($packages)
  4456. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4457. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4458. ->setRunScripts(!$input->getOption('no-scripts'))
  4459. ;
  4460. $status = $install->run();
  4461. if ($status !== 0) {
  4462. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4463. file_put_contents($jsonFile->getPath(), $composerBackup);
  4464. }
  4465. return $status;
  4466. }
  4467. }
  4468. <?php
  4469. namespace Composer\Command;
  4470. use Symfony\Component\Console\Input\InputInterface;
  4471. use Symfony\Component\Console\Input\InputArgument;
  4472. use Symfony\Component\Console\Input\InputOption;
  4473. use Symfony\Component\Console\Output\OutputInterface;
  4474. use Composer\Factory;
  4475. use Composer\Installer;
  4476. use Composer\Json\JsonFile;
  4477. use Composer\Json\JsonManipulator;
  4478. use Composer\Package\Version\VersionParser;
  4479. use Composer\Plugin\CommandEvent;
  4480. use Composer\Plugin\PluginEvents;
  4481. use Composer\Repository\CompositeRepository;
  4482. use Composer\Repository\PlatformRepository;
  4483. use Composer\IO\IOInterface;
  4484. use Composer\Util\Silencer;
  4485. class RequireCommand extends InitCommand
  4486. {
  4487. private $newlyCreated;
  4488. private $json;
  4489. private $file;
  4490. private $composerBackup;
  4491. protected function configure()
  4492. {
  4493. $this
  4494. ->setName('require')
  4495. ->setDescription('Adds required packages to your composer.json and installs them.')
  4496. ->setDefinition(array(
  4497. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include 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"'),
  4498. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4499. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4500. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4501. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4502. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4503. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4504. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4505. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4506. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4507. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4508. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4509. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4510. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4511. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4512. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4513. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4514. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4515. ))
  4516. ->setHelp(
  4517. <<<EOT
  4518. The require command adds required packages to your composer.json and installs them.
  4519. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4520. matches to require.
  4521. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4522. If you do not want to install the new dependencies immediately you can call it with --no-update
  4523. Read more at https://getcomposer.org/doc/03-cli.md#require
  4524. EOT
  4525. )
  4526. ;
  4527. }
  4528. protected function execute(InputInterface $input, OutputInterface $output)
  4529. {
  4530. if (function_exists('pcntl_async_signals')) {
  4531. pcntl_async_signals(true);
  4532. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4533. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4534. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4535. }
  4536. $this->file = Factory::getComposerFile();
  4537. $io = $this->getIO();
  4538. $this->newlyCreated = !file_exists($this->file);
  4539. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4540. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4541. return 1;
  4542. }
  4543. if (!is_readable($this->file)) {
  4544. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4545. return 1;
  4546. }
  4547. if (filesize($this->file) === 0) {
  4548. file_put_contents($this->file, "{\n}\n");
  4549. }
  4550. $this->json = new JsonFile($this->file);
  4551. $this->composerBackup = file_get_contents($this->json->getPath());
  4552. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4553. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4554. return 1;
  4555. }
  4556. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4557. $repos = $composer->getRepositoryManager()->getRepositories();
  4558. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4559. $this->repos = new CompositeRepository(array_merge(
  4560. array(new PlatformRepository(array(), $platformOverrides)),
  4561. $repos
  4562. ));
  4563. if ($composer->getPackage()->getPreferStable()) {
  4564. $preferredStability = 'stable';
  4565. } else {
  4566. $preferredStability = $composer->getPackage()->getMinimumStability();
  4567. }
  4568. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4569. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'));
  4570. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4571. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4572. $requirements = $this->formatRequirements($requirements);
  4573. $versionParser = new VersionParser();
  4574. foreach ($requirements as $package => $constraint) {
  4575. if (strtolower($package) === $composer->getPackage()->getName()) {
  4576. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4577. return 1;
  4578. }
  4579. $versionParser->parseConstraints($constraint);
  4580. }
  4581. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4582. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4583. $composerDefinition = $this->json->read();
  4584. foreach ($requirements as $package => $version) {
  4585. $composerDefinition[$requireKey][$package] = $version;
  4586. unset($composerDefinition[$removeKey][$package]);
  4587. }
  4588. $this->json->write($composerDefinition);
  4589. }
  4590. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4591. if ($input->getOption('no-update')) {
  4592. return 0;
  4593. }
  4594. try {
  4595. return $this->doUpdate($input, $output, $io, $requirements);
  4596. } catch (\Exception $e) {
  4597. $this->revertComposerFile(false);
  4598. throw $e;
  4599. }
  4600. }
  4601. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4602. {
  4603. $this->resetComposer();
  4604. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4605. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4606. $updateDevMode = !$input->getOption('update-no-dev');
  4607. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4608. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4609. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4610. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4611. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4612. $install = Installer::create($io, $composer);
  4613. $install
  4614. ->setVerbose($input->getOption('verbose'))
  4615. ->setPreferSource($input->getOption('prefer-source'))
  4616. ->setPreferDist($input->getOption('prefer-dist'))
  4617. ->setDevMode($updateDevMode)
  4618. ->setRunScripts(!$input->getOption('no-scripts'))
  4619. ->setSkipSuggest($input->getOption('no-suggest'))
  4620. ->setOptimizeAutoloader($optimize)
  4621. ->setClassMapAuthoritative($authoritative)
  4622. ->setApcuAutoloader($apcu)
  4623. ->setUpdate(true)
  4624. ->setUpdateWhitelist(array_keys($requirements))
  4625. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4626. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4627. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4628. ->setPreferStable($input->getOption('prefer-stable'))
  4629. ->setPreferLowest($input->getOption('prefer-lowest'))
  4630. ;
  4631. $status = $install->run();
  4632. if ($status !== 0) {
  4633. $this->revertComposerFile(false);
  4634. }
  4635. return $status;
  4636. }
  4637. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4638. {
  4639. $contents = file_get_contents($json->getPath());
  4640. $manipulator = new JsonManipulator($contents);
  4641. foreach ($new as $package => $constraint) {
  4642. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4643. return false;
  4644. }
  4645. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4646. return false;
  4647. }
  4648. }
  4649. file_put_contents($json->getPath(), $manipulator->getContents());
  4650. return true;
  4651. }
  4652. protected function interact(InputInterface $input, OutputInterface $output)
  4653. {
  4654. return;
  4655. }
  4656. public function revertComposerFile($hardExit = true)
  4657. {
  4658. $io = $this->getIO();
  4659. if ($this->newlyCreated) {
  4660. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4661. unlink($this->json->getPath());
  4662. } else {
  4663. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4664. file_put_contents($this->json->getPath(), $this->composerBackup);
  4665. }
  4666. if ($hardExit) {
  4667. exit(1);
  4668. }
  4669. }
  4670. }
  4671. <?php
  4672. namespace Composer\Command;
  4673. use Composer\Script\Event as ScriptEvent;
  4674. use Composer\Script\ScriptEvents;
  4675. use Composer\Util\ProcessExecutor;
  4676. use Symfony\Component\Console\Input\InputInterface;
  4677. use Symfony\Component\Console\Input\InputOption;
  4678. use Symfony\Component\Console\Input\InputArgument;
  4679. use Symfony\Component\Console\Output\OutputInterface;
  4680. use Symfony\Component\Console\Helper\Table;
  4681. class RunScriptCommand extends BaseCommand
  4682. {
  4683. protected $scriptEvents = array(
  4684. ScriptEvents::PRE_INSTALL_CMD,
  4685. ScriptEvents::POST_INSTALL_CMD,
  4686. ScriptEvents::PRE_UPDATE_CMD,
  4687. ScriptEvents::POST_UPDATE_CMD,
  4688. ScriptEvents::PRE_STATUS_CMD,
  4689. ScriptEvents::POST_STATUS_CMD,
  4690. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4691. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4692. ScriptEvents::PRE_ARCHIVE_CMD,
  4693. ScriptEvents::POST_ARCHIVE_CMD,
  4694. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4695. ScriptEvents::POST_AUTOLOAD_DUMP,
  4696. );
  4697. protected function configure()
  4698. {
  4699. $this
  4700. ->setName('run-script')
  4701. ->setAliases(array('run'))
  4702. ->setDescription('Runs the scripts defined in composer.json.')
  4703. ->setDefinition(array(
  4704. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4705. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4706. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4707. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4708. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4709. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4710. ))
  4711. ->setHelp(
  4712. <<<EOT
  4713. The <info>run-script</info> command runs scripts defined in composer.json:
  4714. <info>php composer.phar run-script post-update-cmd</info>
  4715. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4716. EOT
  4717. )
  4718. ;
  4719. }
  4720. protected function execute(InputInterface $input, OutputInterface $output)
  4721. {
  4722. if ($input->getOption('list')) {
  4723. return $this->listScripts($output);
  4724. } elseif (!$input->getArgument('script')) {
  4725. throw new \RuntimeException('Missing required argument "script"');
  4726. }
  4727. $script = $input->getArgument('script');
  4728. if (!in_array($script, $this->scriptEvents)) {
  4729. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4730. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4731. }
  4732. }
  4733. $composer = $this->getComposer();
  4734. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4735. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4736. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4737. if (!$hasListeners) {
  4738. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4739. }
  4740. $args = $input->getArgument('args');
  4741. if (null !== $timeout = $input->getOption('timeout')) {
  4742. if (!ctype_digit($timeout)) {
  4743. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4744. }
  4745. ProcessExecutor::setTimeout((int) $timeout);
  4746. }
  4747. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4748. }
  4749. protected function listScripts(OutputInterface $output)
  4750. {
  4751. $scripts = $this->getComposer()->getPackage()->getScripts();
  4752. if (!count($scripts)) {
  4753. return 0;
  4754. }
  4755. $io = $this->getIO();
  4756. $io->writeError('<info>scripts:</info>');
  4757. $table = array();
  4758. foreach ($scripts as $name => $script) {
  4759. $description = '';
  4760. try {
  4761. $cmd = $this->getApplication()->find($name);
  4762. if ($cmd instanceof ScriptAliasCommand) {
  4763. $description = $cmd->getDescription();
  4764. }
  4765. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4766. }
  4767. $table[] = array(' '.$name, $description);
  4768. }
  4769. $renderer = new Table($output);
  4770. $renderer->setStyle('compact');
  4771. $rendererStyle = $renderer->getStyle();
  4772. $rendererStyle->setVerticalBorderChar('');
  4773. $rendererStyle->setCellRowContentFormat('%s ');
  4774. $renderer->setRows($table)->render();
  4775. return 0;
  4776. }
  4777. }
  4778. <?php
  4779. namespace Composer\Command;
  4780. use Symfony\Component\Console\Input\InputInterface;
  4781. use Symfony\Component\Console\Input\InputOption;
  4782. use Symfony\Component\Console\Input\InputArgument;
  4783. use Symfony\Component\Console\Output\OutputInterface;
  4784. class ScriptAliasCommand extends BaseCommand
  4785. {
  4786. private $script;
  4787. private $description;
  4788. public function __construct($script, $description)
  4789. {
  4790. $this->script = $script;
  4791. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4792. parent::__construct();
  4793. }
  4794. protected function configure()
  4795. {
  4796. $this
  4797. ->setName($this->script)
  4798. ->setDescription($this->description)
  4799. ->setDefinition(array(
  4800. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4801. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4802. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4803. ))
  4804. ->setHelp(
  4805. <<<EOT
  4806. The <info>run-script</info> command runs scripts defined in composer.json:
  4807. <info>php composer.phar run-script post-update-cmd</info>
  4808. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4809. EOT
  4810. )
  4811. ;
  4812. }
  4813. protected function execute(InputInterface $input, OutputInterface $output)
  4814. {
  4815. $composer = $this->getComposer();
  4816. $args = $input->getArguments();
  4817. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4818. }
  4819. }
  4820. <?php
  4821. namespace Composer\Command;
  4822. use Composer\Factory;
  4823. use Symfony\Component\Console\Input\InputInterface;
  4824. use Symfony\Component\Console\Input\InputArgument;
  4825. use Symfony\Component\Console\Input\InputOption;
  4826. use Symfony\Component\Console\Output\OutputInterface;
  4827. use Composer\Repository\CompositeRepository;
  4828. use Composer\Repository\PlatformRepository;
  4829. use Composer\Repository\RepositoryInterface;
  4830. use Composer\Plugin\CommandEvent;
  4831. use Composer\Plugin\PluginEvents;
  4832. class SearchCommand extends BaseCommand
  4833. {
  4834. protected $matches;
  4835. protected $lowMatches = array();
  4836. protected $tokens;
  4837. protected $output;
  4838. protected $onlyName;
  4839. protected function configure()
  4840. {
  4841. $this
  4842. ->setName('search')
  4843. ->setDescription('Searches for packages.')
  4844. ->setDefinition(array(
  4845. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4846. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4847. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4848. ))
  4849. ->setHelp(
  4850. <<<EOT
  4851. The search command searches for packages by its name
  4852. <info>php composer.phar search symfony composer</info>
  4853. Read more at https://getcomposer.org/doc/03-cli.md#search
  4854. EOT
  4855. )
  4856. ;
  4857. }
  4858. protected function execute(InputInterface $input, OutputInterface $output)
  4859. {
  4860. $platformRepo = new PlatformRepository;
  4861. $io = $this->getIO();
  4862. if (!($composer = $this->getComposer(false))) {
  4863. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4864. }
  4865. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4866. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4867. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4868. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4869. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4870. $onlyName = $input->getOption('only-name');
  4871. $type = $input->getOption('type') ?: null;
  4872. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4873. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4874. foreach ($results as $result) {
  4875. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4876. }
  4877. }
  4878. }
  4879. <?php
  4880. namespace Composer\Command;
  4881. use Composer\Composer;
  4882. use Composer\Factory;
  4883. use Composer\Config;
  4884. use Composer\Util\Filesystem;
  4885. use Composer\SelfUpdate\Keys;
  4886. use Composer\SelfUpdate\Versions;
  4887. use Composer\IO\IOInterface;
  4888. use Composer\Downloader\FilesystemException;
  4889. use Symfony\Component\Console\Input\InputInterface;
  4890. use Symfony\Component\Console\Input\InputOption;
  4891. use Symfony\Component\Console\Input\InputArgument;
  4892. use Symfony\Component\Console\Output\OutputInterface;
  4893. use Symfony\Component\Finder\Finder;
  4894. class SelfUpdateCommand extends BaseCommand
  4895. {
  4896. const HOMEPAGE = 'getcomposer.org';
  4897. const OLD_INSTALL_EXT = '-old.phar';
  4898. protected function configure()
  4899. {
  4900. $this
  4901. ->setName('self-update')
  4902. ->setAliases(array('selfupdate'))
  4903. ->setDescription('Updates composer.phar to the latest version.')
  4904. ->setDefinition(array(
  4905. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4906. 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'),
  4907. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4908. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4909. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4910. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4911. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4912. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4913. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4914. ))
  4915. ->setHelp(
  4916. <<<EOT
  4917. The <info>self-update</info> command checks getcomposer.org for newer
  4918. versions of composer and if found, installs the latest.
  4919. <info>php composer.phar self-update</info>
  4920. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  4921. EOT
  4922. )
  4923. ;
  4924. }
  4925. protected function execute(InputInterface $input, OutputInterface $output)
  4926. {
  4927. $config = Factory::createConfig();
  4928. if ($config->get('disable-tls') === true) {
  4929. $baseUrl = 'http://' . self::HOMEPAGE;
  4930. } else {
  4931. $baseUrl = 'https://' . self::HOMEPAGE;
  4932. }
  4933. $io = $this->getIO();
  4934. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4935. $versionsUtil = new Versions($config, $remoteFilesystem);
  4936. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4937. if ($input->getOption($channel)) {
  4938. $versionsUtil->setChannel($channel);
  4939. }
  4940. }
  4941. if ($input->getOption('set-channel-only')) {
  4942. return 0;
  4943. }
  4944. $cacheDir = $config->get('cache-dir');
  4945. $rollbackDir = $config->get('data-dir');
  4946. $home = $config->get('home');
  4947. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4948. if ($input->getOption('update-keys')) {
  4949. return $this->fetchKeys($io, $config);
  4950. }
  4951. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4952. if (!is_writable($tmpDir)) {
  4953. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4954. }
  4955. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4956. $composeUser = posix_getpwuid(posix_geteuid());
  4957. $homeOwner = posix_getpwuid(fileowner($home));
  4958. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4959. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4960. }
  4961. }
  4962. if ($input->getOption('rollback')) {
  4963. return $this->rollback($output, $rollbackDir, $localFilename);
  4964. }
  4965. $latest = $versionsUtil->getLatest();
  4966. $latestVersion = $latest['version'];
  4967. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4968. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4969. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4970. return 1;
  4971. }
  4972. if (Composer::VERSION === $updateVersion) {
  4973. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4974. if ($input->getOption('clean-backups')) {
  4975. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4976. }
  4977. return 0;
  4978. }
  4979. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4980. $backupFile = sprintf(
  4981. '%s/%s-%s%s',
  4982. $rollbackDir,
  4983. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4984. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4985. self::OLD_INSTALL_EXT
  4986. );
  4987. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4988. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4989. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4990. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4991. $io->writeError(' ', false);
  4992. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4993. $io->writeError('');
  4994. if (!file_exists($tempFilename) || !$signature) {
  4995. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4996. return 1;
  4997. }
  4998. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4999. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5000. } else {
  5001. if (!extension_loaded('openssl')) {
  5002. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5003. . '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.');
  5004. }
  5005. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5006. if (!file_exists($sigFile)) {
  5007. file_put_contents(
  5008. $home.'/keys.dev.pub',
  5009. <<<DEVPUBKEY
  5010. -----BEGIN PUBLIC KEY-----
  5011. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5012. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5013. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5014. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5015. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5016. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5017. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5018. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5019. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5020. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5021. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5022. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5023. -----END PUBLIC KEY-----
  5024. DEVPUBKEY
  5025. );
  5026. file_put_contents(
  5027. $home.'/keys.tags.pub',
  5028. <<<TAGSPUBKEY
  5029. -----BEGIN PUBLIC KEY-----
  5030. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5031. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5032. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5033. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5034. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5035. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5036. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5037. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5038. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5039. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5040. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5041. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5042. -----END PUBLIC KEY-----
  5043. TAGSPUBKEY
  5044. );
  5045. }
  5046. $pubkeyid = openssl_pkey_get_public($sigFile);
  5047. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5048. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5049. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5050. }
  5051. $signature = json_decode($signature, true);
  5052. $signature = base64_decode($signature['sha384']);
  5053. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5054. openssl_free_key($pubkeyid);
  5055. if (!$verified) {
  5056. 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');
  5057. }
  5058. }
  5059. if ($input->getOption('clean-backups')) {
  5060. $this->cleanBackups($rollbackDir);
  5061. }
  5062. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5063. @unlink($tempFilename);
  5064. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  5065. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5066. return 1;
  5067. }
  5068. if (file_exists($backupFile)) {
  5069. $io->writeError(sprintf(
  5070. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5071. Composer::VERSION
  5072. ));
  5073. } else {
  5074. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5075. }
  5076. }
  5077. protected function fetchKeys(IOInterface $io, Config $config)
  5078. {
  5079. if (!$io->isInteractive()) {
  5080. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5081. }
  5082. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5083. $validator = function ($value) {
  5084. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5085. throw new \UnexpectedValueException('Invalid input');
  5086. }
  5087. return trim($value)."\n";
  5088. };
  5089. $devKey = '';
  5090. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5091. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5092. while ($line = $io->ask('')) {
  5093. $devKey .= trim($line)."\n";
  5094. if (trim($line) === '-----END PUBLIC KEY-----') {
  5095. break;
  5096. }
  5097. }
  5098. }
  5099. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5100. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5101. $tagsKey = '';
  5102. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5103. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5104. while ($line = $io->ask('')) {
  5105. $tagsKey .= trim($line)."\n";
  5106. if (trim($line) === '-----END PUBLIC KEY-----') {
  5107. break;
  5108. }
  5109. }
  5110. }
  5111. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5112. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5113. $io->write('Public keys stored in '.$config->get('home'));
  5114. }
  5115. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5116. {
  5117. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5118. if (!$rollbackVersion) {
  5119. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5120. }
  5121. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5122. if (!is_file($oldFile)) {
  5123. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5124. }
  5125. if (!is_readable($oldFile)) {
  5126. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5127. }
  5128. $io = $this->getIO();
  5129. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5130. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  5131. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  5132. return 1;
  5133. }
  5134. return 0;
  5135. }
  5136. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5137. {
  5138. try {
  5139. @chmod($newFilename, fileperms($localFilename));
  5140. if (!ini_get('phar.readonly')) {
  5141. $phar = new \Phar($newFilename);
  5142. unset($phar);
  5143. }
  5144. if ($backupTarget && file_exists($localFilename)) {
  5145. @copy($localFilename, $backupTarget);
  5146. }
  5147. rename($newFilename, $localFilename);
  5148. return null;
  5149. } catch (\Exception $e) {
  5150. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5151. throw $e;
  5152. }
  5153. return $e;
  5154. }
  5155. }
  5156. protected function cleanBackups($rollbackDir, $except = null)
  5157. {
  5158. $finder = $this->getOldInstallationFinder($rollbackDir);
  5159. $io = $this->getIO();
  5160. $fs = new Filesystem;
  5161. foreach ($finder as $file) {
  5162. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5163. continue;
  5164. }
  5165. $file = (string) $file;
  5166. $io->writeError('<info>Removing: '.$file.'</info>');
  5167. $fs->remove($file);
  5168. }
  5169. }
  5170. protected function getLastBackupVersion($rollbackDir)
  5171. {
  5172. $finder = $this->getOldInstallationFinder($rollbackDir);
  5173. $finder->sortByName();
  5174. $files = iterator_to_array($finder);
  5175. if (count($files)) {
  5176. return basename(end($files), self::OLD_INSTALL_EXT);
  5177. }
  5178. return false;
  5179. }
  5180. protected function getOldInstallationFinder($rollbackDir)
  5181. {
  5182. $finder = Finder::create()
  5183. ->depth(0)
  5184. ->files()
  5185. ->name('*' . self::OLD_INSTALL_EXT)
  5186. ->in($rollbackDir);
  5187. return $finder;
  5188. }
  5189. }
  5190. <?php
  5191. namespace Composer\Command;
  5192. use Composer\Composer;
  5193. use Composer\DependencyResolver\DefaultPolicy;
  5194. use Composer\DependencyResolver\Pool;
  5195. use Composer\Json\JsonFile;
  5196. use Composer\Package\BasePackage;
  5197. use Composer\Package\CompletePackageInterface;
  5198. use Composer\Package\PackageInterface;
  5199. use Composer\Package\Version\VersionParser;
  5200. use Composer\Package\Version\VersionSelector;
  5201. use Composer\Plugin\CommandEvent;
  5202. use Composer\Plugin\PluginEvents;
  5203. use Composer\Repository\ArrayRepository;
  5204. use Composer\Repository\ComposerRepository;
  5205. use Composer\Repository\CompositeRepository;
  5206. use Composer\Repository\PlatformRepository;
  5207. use Composer\Repository\RepositoryFactory;
  5208. use Composer\Repository\RepositoryInterface;
  5209. use Composer\Semver\Constraint\ConstraintInterface;
  5210. use Composer\Semver\Semver;
  5211. use Composer\Spdx\SpdxLicenses;
  5212. use Composer\Util\Platform;
  5213. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5214. use Symfony\Component\Console\Input\InputArgument;
  5215. use Symfony\Component\Console\Input\InputInterface;
  5216. use Symfony\Component\Console\Input\InputOption;
  5217. use Symfony\Component\Console\Output\OutputInterface;
  5218. use Symfony\Component\Console\Terminal;
  5219. class ShowCommand extends BaseCommand
  5220. {
  5221. protected $versionParser;
  5222. protected $colors;
  5223. private $pool;
  5224. protected function configure()
  5225. {
  5226. $this
  5227. ->setName('show')
  5228. ->setAliases(array('info'))
  5229. ->setDescription('Shows information about packages.')
  5230. ->setDefinition(array(
  5231. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5232. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5233. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5234. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5235. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5236. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5237. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5238. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5239. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5240. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5241. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5242. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5243. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5244. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5245. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5246. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5247. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5248. ))
  5249. ->setHelp(
  5250. <<<EOT
  5251. The show command displays detailed information about a package, or
  5252. lists all packages available.
  5253. Read more at https://getcomposer.org/doc/03-cli.md#show
  5254. EOT
  5255. )
  5256. ;
  5257. }
  5258. protected function execute(InputInterface $input, OutputInterface $output)
  5259. {
  5260. $this->versionParser = new VersionParser;
  5261. if ($input->getOption('tree')) {
  5262. $this->initStyles($output);
  5263. }
  5264. $composer = $this->getComposer(false);
  5265. $io = $this->getIO();
  5266. if ($input->getOption('installed')) {
  5267. $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>');
  5268. }
  5269. if ($input->getOption('outdated')) {
  5270. $input->setOption('latest', true);
  5271. } elseif ($input->getOption('ignore')) {
  5272. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5273. }
  5274. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5275. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5276. return 1;
  5277. }
  5278. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5279. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5280. return 1;
  5281. }
  5282. if ($input->getOption('tree') && $input->getOption('latest')) {
  5283. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5284. return 1;
  5285. }
  5286. $format = $input->getOption('format');
  5287. if (!in_array($format, array('text', 'json'))) {
  5288. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5289. return 1;
  5290. }
  5291. $platformOverrides = array();
  5292. if ($composer) {
  5293. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5294. }
  5295. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5296. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5297. if ($input->getOption('self')) {
  5298. $package = $this->getComposer()->getPackage();
  5299. $repos = $installedRepo = new ArrayRepository(array($package));
  5300. } elseif ($input->getOption('platform')) {
  5301. $repos = $installedRepo = $platformRepo;
  5302. } elseif ($input->getOption('available')) {
  5303. $installedRepo = $platformRepo;
  5304. if ($composer) {
  5305. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5306. } else {
  5307. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5308. $repos = new CompositeRepository($defaultRepos);
  5309. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5310. }
  5311. } elseif ($input->getOption('all') && $composer) {
  5312. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5313. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5314. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5315. } elseif ($input->getOption('all')) {
  5316. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5317. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5318. $installedRepo = $platformRepo;
  5319. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5320. } else {
  5321. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5322. $rootPkg = $this->getComposer()->getPackage();
  5323. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5324. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5325. }
  5326. }
  5327. if ($composer) {
  5328. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5329. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5330. }
  5331. if ($input->getOption('latest') && null === $composer) {
  5332. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5333. $input->setOption('latest', false);
  5334. }
  5335. $packageFilter = $input->getArgument('package');
  5336. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5337. if (empty($package)) {
  5338. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5339. if (empty($package)) {
  5340. $options = $input->getOptions();
  5341. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5342. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5343. }
  5344. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5345. return 1;
  5346. }
  5347. } else {
  5348. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5349. }
  5350. $exitCode = 0;
  5351. if ($input->getOption('tree')) {
  5352. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5353. if ('json' === $format) {
  5354. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5355. } else {
  5356. $this->displayPackageTree(array($arrayTree));
  5357. }
  5358. } else {
  5359. $latestPackage = null;
  5360. if ($input->getOption('latest')) {
  5361. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5362. }
  5363. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5364. $exitCode = 1;
  5365. }
  5366. if ($input->getOption('path')) {
  5367. $io->write($package->getName(), false);
  5368. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5369. return $exitCode;
  5370. }
  5371. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5372. $this->printLinks($package, 'requires');
  5373. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5374. if ($package->getSuggests()) {
  5375. $io->write("\n<info>suggests</info>");
  5376. foreach ($package->getSuggests() as $suggested => $reason) {
  5377. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5378. }
  5379. }
  5380. $this->printLinks($package, 'provides');
  5381. $this->printLinks($package, 'conflicts');
  5382. $this->printLinks($package, 'replaces');
  5383. }
  5384. return $exitCode;
  5385. }
  5386. if ($input->getOption('tree')) {
  5387. $rootRequires = $this->getRootRequires();
  5388. $packages = $installedRepo->getPackages();
  5389. usort($packages, 'strcmp');
  5390. $arrayTree = array();
  5391. foreach ($packages as $package) {
  5392. if (in_array($package->getName(), $rootRequires, true)) {
  5393. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5394. }
  5395. }
  5396. if ('json' === $format) {
  5397. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5398. } else {
  5399. $this->displayPackageTree($arrayTree);
  5400. }
  5401. return 0;
  5402. }
  5403. if ($repos instanceof CompositeRepository) {
  5404. $repos = $repos->getRepositories();
  5405. } elseif (!is_array($repos)) {
  5406. $repos = array($repos);
  5407. }
  5408. $packages = array();
  5409. if (null !== $packageFilter) {
  5410. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5411. }
  5412. $packageListFilter = array();
  5413. if ($input->getOption('direct')) {
  5414. $packageListFilter = $this->getRootRequires();
  5415. }
  5416. if (class_exists('Symfony\Component\Console\Terminal')) {
  5417. $terminal = new Terminal();
  5418. $width = $terminal->getWidth();
  5419. } else {
  5420. list($width) = $this->getApplication()->getTerminalDimensions();
  5421. }
  5422. if (null === $width) {
  5423. $width = PHP_INT_MAX;
  5424. }
  5425. if (Platform::isWindows()) {
  5426. $width--;
  5427. } else {
  5428. $width = max(80, $width);
  5429. }
  5430. if ($input->getOption('path') && null === $composer) {
  5431. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5432. $input->setOption('path', false);
  5433. }
  5434. foreach ($repos as $repo) {
  5435. if ($repo === $platformRepo) {
  5436. $type = 'platform';
  5437. } elseif (
  5438. $repo === $installedRepo
  5439. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5440. ) {
  5441. $type = 'installed';
  5442. } else {
  5443. $type = 'available';
  5444. }
  5445. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5446. foreach ($repo->getProviderNames() as $name) {
  5447. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5448. $packages[$type][$name] = $name;
  5449. }
  5450. }
  5451. } else {
  5452. foreach ($repo->getPackages() as $package) {
  5453. if (!isset($packages[$type][$package->getName()])
  5454. || !is_object($packages[$type][$package->getName()])
  5455. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5456. ) {
  5457. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5458. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5459. $packages[$type][$package->getName()] = $package;
  5460. }
  5461. }
  5462. }
  5463. }
  5464. }
  5465. }
  5466. $showAllTypes = $input->getOption('all');
  5467. $showLatest = $input->getOption('latest');
  5468. $showMinorOnly = $input->getOption('minor-only');
  5469. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5470. $indent = $showAllTypes ? ' ' : '';
  5471. $latestPackages = array();
  5472. $exitCode = 0;
  5473. $viewData = array();
  5474. $viewMetaData = array();
  5475. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5476. if (isset($packages[$type])) {
  5477. ksort($packages[$type]);
  5478. $nameLength = $versionLength = $latestLength = 0;
  5479. if ($showLatest && $showVersion) {
  5480. foreach ($packages[$type] as $package) {
  5481. if (is_object($package)) {
  5482. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5483. if ($latestPackage === false) {
  5484. continue;
  5485. }
  5486. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5487. }
  5488. }
  5489. }
  5490. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5491. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5492. $writeLatest = $writeVersion && $showLatest;
  5493. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5494. $hasOutdatedPackages = false;
  5495. $viewData[$type] = array();
  5496. foreach ($packages[$type] as $package) {
  5497. $packageViewData = array();
  5498. if (is_object($package)) {
  5499. $latestPackage = null;
  5500. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5501. $latestPackage = $latestPackages[$package->getPrettyName()];
  5502. }
  5503. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5504. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5505. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5506. continue;
  5507. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5508. $hasOutdatedPackages = true;
  5509. }
  5510. $packageViewData['name'] = $package->getPrettyName();
  5511. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5512. if ($writeVersion) {
  5513. $packageViewData['version'] = $package->getFullPrettyVersion();
  5514. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5515. }
  5516. if ($writeLatest && $latestPackage) {
  5517. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5518. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5519. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5520. }
  5521. if ($writeDescription) {
  5522. $packageViewData['description'] = $package->getDescription();
  5523. }
  5524. if ($writePath) {
  5525. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5526. }
  5527. if ($latestPackage && $latestPackage->isAbandoned()) {
  5528. $replacement = is_string($latestPackage->getReplacementPackage())
  5529. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5530. : 'No replacement was suggested';
  5531. $packageWarning = sprintf(
  5532. 'Package %s is abandoned, you should avoid using it. %s.',
  5533. $package->getPrettyName(),
  5534. $replacement
  5535. );
  5536. $packageViewData['warning'] = $packageWarning;
  5537. }
  5538. } else {
  5539. $packageViewData['name'] = $package;
  5540. $nameLength = max($nameLength, strlen($package));
  5541. }
  5542. $viewData[$type][] = $packageViewData;
  5543. }
  5544. $viewMetaData[$type] = array(
  5545. 'nameLength' => $nameLength,
  5546. 'versionLength' => $versionLength,
  5547. 'latestLength' => $latestLength,
  5548. );
  5549. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5550. $exitCode = 1;
  5551. break;
  5552. }
  5553. }
  5554. }
  5555. if ('json' === $format) {
  5556. $io->write(JsonFile::encode($viewData));
  5557. } else {
  5558. foreach ($viewData as $type => $packages) {
  5559. $nameLength = $viewMetaData[$type]['nameLength'];
  5560. $versionLength = $viewMetaData[$type]['versionLength'];
  5561. $latestLength = $viewMetaData[$type]['latestLength'];
  5562. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5563. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5564. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5565. if ($writeLatest && !$io->isDecorated()) {
  5566. $latestLength += 2;
  5567. }
  5568. if ($showAllTypes) {
  5569. if ('available' === $type) {
  5570. $io->write('<comment>' . $type . '</comment>:');
  5571. } else {
  5572. $io->write('<info>' . $type . '</info>:');
  5573. }
  5574. }
  5575. foreach ($packages as $package) {
  5576. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5577. if (isset($package['version']) && $writeVersion) {
  5578. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5579. }
  5580. if (isset($package['latest']) && $writeLatest) {
  5581. $latestVersion = $package['latest'];
  5582. $updateStatus = $package['latest-status'];
  5583. $style = $this->updateStatusToVersionStyle($updateStatus);
  5584. if (!$io->isDecorated()) {
  5585. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5586. }
  5587. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5588. }
  5589. if (isset($package['description']) && $writeDescription) {
  5590. $description = strtok($package['description'], "\r\n");
  5591. $remaining = $width - $nameLength - $versionLength - 4;
  5592. if ($writeLatest) {
  5593. $remaining -= $latestLength;
  5594. }
  5595. if (strlen($description) > $remaining) {
  5596. $description = substr($description, 0, $remaining - 3) . '...';
  5597. }
  5598. $io->write(' ' . $description, false);
  5599. }
  5600. if (isset($package['path'])) {
  5601. $io->write(' ' . $package['path'], false);
  5602. }
  5603. $io->write('');
  5604. if (isset($package['warning'])) {
  5605. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5606. }
  5607. }
  5608. if ($showAllTypes) {
  5609. $io->write('');
  5610. }
  5611. }
  5612. }
  5613. return $exitCode;
  5614. }
  5615. protected function getRootRequires()
  5616. {
  5617. $rootPackage = $this->getComposer()->getPackage();
  5618. return array_map(
  5619. 'strtolower',
  5620. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5621. );
  5622. }
  5623. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5624. {
  5625. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5626. }
  5627. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5628. {
  5629. $name = strtolower($name);
  5630. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5631. $policy = new DefaultPolicy();
  5632. $pool = new Pool('dev');
  5633. $pool->addRepository($repos);
  5634. $matchedPackage = null;
  5635. $versions = array();
  5636. $matches = $pool->whatProvides($name, $constraint);
  5637. foreach ($matches as $index => $package) {
  5638. if ($package->getName() !== $name) {
  5639. unset($matches[$index]);
  5640. continue;
  5641. }
  5642. if (null === $version && $installedRepo->hasPackage($package)) {
  5643. $matchedPackage = $package;
  5644. }
  5645. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5646. $matches[$index] = $package->getId();
  5647. }
  5648. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5649. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5650. }
  5651. return array($matchedPackage, $versions);
  5652. }
  5653. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5654. {
  5655. $io = $this->getIO();
  5656. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5657. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5658. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5659. $this->printVersions($package, $versions, $installedRepo);
  5660. if ($latestPackage) {
  5661. $style = $this->getVersionStyle($latestPackage, $package);
  5662. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5663. } else {
  5664. $latestPackage = $package;
  5665. }
  5666. $io->write('<info>type</info> : ' . $package->getType());
  5667. $this->printLicenses($package);
  5668. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5669. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5670. if ($installedRepo->hasPackage($package)) {
  5671. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5672. }
  5673. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5674. if ($latestPackage->isAbandoned()) {
  5675. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5676. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5677. : null;
  5678. $io->writeError(
  5679. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5680. );
  5681. }
  5682. if ($package->getSupport()) {
  5683. $io->write("\n<info>support</info>");
  5684. foreach ($package->getSupport() as $type => $value) {
  5685. $io->write('<comment>' . $type . '</comment> : '.$value);
  5686. }
  5687. }
  5688. if ($package->getAutoload()) {
  5689. $io->write("\n<info>autoload</info>");
  5690. foreach ($package->getAutoload() as $type => $autoloads) {
  5691. $io->write('<comment>' . $type . '</comment>');
  5692. if ($type === 'psr-0') {
  5693. foreach ($autoloads as $name => $path) {
  5694. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5695. }
  5696. } elseif ($type === 'psr-4') {
  5697. foreach ($autoloads as $name => $path) {
  5698. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5699. }
  5700. } elseif ($type === 'classmap') {
  5701. $io->write(implode(', ', $autoloads));
  5702. }
  5703. }
  5704. if ($package->getIncludePaths()) {
  5705. $io->write('<comment>include-path</comment>');
  5706. $io->write(implode(', ', $package->getIncludePaths()));
  5707. }
  5708. }
  5709. }
  5710. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5711. {
  5712. uasort($versions, 'version_compare');
  5713. $versions = array_keys(array_reverse($versions));
  5714. if ($installedRepo->hasPackage($package)) {
  5715. $installedVersion = $package->getPrettyVersion();
  5716. $key = array_search($installedVersion, $versions);
  5717. if (false !== $key) {
  5718. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5719. }
  5720. }
  5721. $versions = implode(', ', $versions);
  5722. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5723. }
  5724. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5725. {
  5726. $title = $title ?: $linkType;
  5727. $io = $this->getIO();
  5728. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5729. $io->write("\n<info>" . $title . "</info>");
  5730. foreach ($links as $link) {
  5731. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5732. }
  5733. }
  5734. }
  5735. protected function printLicenses(CompletePackageInterface $package)
  5736. {
  5737. $spdxLicenses = new SpdxLicenses();
  5738. $licenses = $package->getLicense();
  5739. $io = $this->getIO();
  5740. foreach ($licenses as $licenseId) {
  5741. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5742. if (!$license) {
  5743. $out = $licenseId;
  5744. } else {
  5745. if ($license[1] === true) {
  5746. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5747. } else {
  5748. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5749. }
  5750. }
  5751. $io->write('<info>license</info> : ' . $out);
  5752. }
  5753. }
  5754. protected function initStyles(OutputInterface $output)
  5755. {
  5756. $this->colors = array(
  5757. 'green',
  5758. 'yellow',
  5759. 'cyan',
  5760. 'magenta',
  5761. 'blue',
  5762. );
  5763. foreach ($this->colors as $color) {
  5764. $style = new OutputFormatterStyle($color);
  5765. $output->getFormatter()->setStyle($color, $style);
  5766. }
  5767. }
  5768. protected function displayPackageTree(array $arrayTree)
  5769. {
  5770. $io = $this->getIO();
  5771. foreach ($arrayTree as $package) {
  5772. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5773. $io->write(' ' . $package['version'], false);
  5774. $io->write(' ' . strtok($package['description'], "\r\n"));
  5775. if (isset($package['requires'])) {
  5776. $requires = $package['requires'];
  5777. $treeBar = '├';
  5778. $j = 0;
  5779. $total = count($requires);
  5780. foreach ($requires as $require) {
  5781. $requireName = $require['name'];
  5782. $j++;
  5783. if ($j === $total) {
  5784. $treeBar = 'â””';
  5785. }
  5786. $level = 1;
  5787. $color = $this->colors[$level];
  5788. $info = sprintf(
  5789. '%s──<%s>%s</%s> %s',
  5790. $treeBar,
  5791. $color,
  5792. $requireName,
  5793. $color,
  5794. $require['version']
  5795. );
  5796. $this->writeTreeLine($info);
  5797. $treeBar = str_replace('â””', ' ', $treeBar);
  5798. $packagesInTree = array($package['name'], $requireName);
  5799. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5800. }
  5801. }
  5802. }
  5803. }
  5804. protected function generatePackageTree(
  5805. PackageInterface $package,
  5806. RepositoryInterface $installedRepo,
  5807. RepositoryInterface $distantRepos
  5808. ) {
  5809. $requires = $package->getRequires();
  5810. ksort($requires);
  5811. $children = array();
  5812. foreach ($requires as $requireName => $require) {
  5813. $packagesInTree = array($package->getName(), $requireName);
  5814. $treeChildDesc = array(
  5815. 'name' => $requireName,
  5816. 'version' => $require->getPrettyConstraint(),
  5817. );
  5818. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5819. if ($deepChildren) {
  5820. $treeChildDesc['requires'] = $deepChildren;
  5821. }
  5822. $children[] = $treeChildDesc;
  5823. }
  5824. $tree = array(
  5825. 'name' => $package->getPrettyName(),
  5826. 'version' => $package->getPrettyVersion(),
  5827. 'description' => $package->getDescription(),
  5828. );
  5829. if ($children) {
  5830. $tree['requires'] = $children;
  5831. }
  5832. return $tree;
  5833. }
  5834. protected function displayTree(
  5835. $package,
  5836. array $packagesInTree,
  5837. $previousTreeBar = '├',
  5838. $level = 1
  5839. ) {
  5840. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5841. if (isset($package['requires'])) {
  5842. $requires = $package['requires'];
  5843. $treeBar = $previousTreeBar . ' ├';
  5844. $i = 0;
  5845. $total = count($requires);
  5846. foreach ($requires as $require) {
  5847. $currentTree = $packagesInTree;
  5848. $i++;
  5849. if ($i === $total) {
  5850. $treeBar = $previousTreeBar . ' â””';
  5851. }
  5852. $colorIdent = $level % count($this->colors);
  5853. $color = $this->colors[$colorIdent];
  5854. $circularWarn = in_array(
  5855. $require['name'],
  5856. $currentTree,
  5857. true
  5858. ) ? '(circular dependency aborted here)' : '';
  5859. $info = rtrim(sprintf(
  5860. '%s──<%s>%s</%s> %s %s',
  5861. $treeBar,
  5862. $color,
  5863. $require['name'],
  5864. $color,
  5865. $require['version'],
  5866. $circularWarn
  5867. ));
  5868. $this->writeTreeLine($info);
  5869. $treeBar = str_replace('â””', ' ', $treeBar);
  5870. $currentTree[] = $require['name'];
  5871. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5872. }
  5873. }
  5874. }
  5875. protected function addTree(
  5876. $name,
  5877. $package,
  5878. RepositoryInterface $installedRepo,
  5879. RepositoryInterface $distantRepos,
  5880. array $packagesInTree
  5881. ) {
  5882. $children = array();
  5883. list($package, $versions) = $this->getPackage(
  5884. $installedRepo,
  5885. $distantRepos,
  5886. $name,
  5887. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5888. );
  5889. if (is_object($package)) {
  5890. $requires = $package->getRequires();
  5891. ksort($requires);
  5892. foreach ($requires as $requireName => $require) {
  5893. $currentTree = $packagesInTree;
  5894. $treeChildDesc = array(
  5895. 'name' => $requireName,
  5896. 'version' => $require->getPrettyConstraint(),
  5897. );
  5898. if (!in_array($requireName, $currentTree, true)) {
  5899. $currentTree[] = $requireName;
  5900. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5901. if ($deepChildren) {
  5902. $treeChildDesc['requires'] = $deepChildren;
  5903. }
  5904. }
  5905. $children[] = $treeChildDesc;
  5906. }
  5907. }
  5908. return $children;
  5909. }
  5910. private function updateStatusToVersionStyle($updateStatus)
  5911. {
  5912. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5913. }
  5914. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5915. {
  5916. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5917. return 'up-to-date';
  5918. }
  5919. $constraint = $package->getVersion();
  5920. if (0 !== strpos($constraint, 'dev-')) {
  5921. $constraint = '^'.$constraint;
  5922. }
  5923. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5924. return 'semver-safe-update';
  5925. }
  5926. return 'update-possible';
  5927. }
  5928. private function writeTreeLine($line)
  5929. {
  5930. $io = $this->getIO();
  5931. if (!$io->isDecorated()) {
  5932. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5933. }
  5934. $io->write($line);
  5935. }
  5936. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5937. {
  5938. $name = $package->getName();
  5939. $versionSelector = new VersionSelector($this->getPool($composer));
  5940. $stability = $composer->getPackage()->getMinimumStability();
  5941. $flags = $composer->getPackage()->getStabilityFlags();
  5942. if (isset($flags[$name])) {
  5943. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5944. }
  5945. $bestStability = $stability;
  5946. if ($composer->getPackage()->getPreferStable()) {
  5947. $bestStability = $package->getStability();
  5948. }
  5949. $targetVersion = null;
  5950. if (0 === strpos($package->getVersion(), 'dev-')) {
  5951. $targetVersion = $package->getVersion();
  5952. }
  5953. if ($targetVersion === null && $minorOnly) {
  5954. $targetVersion = '^' . $package->getVersion();
  5955. }
  5956. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5957. }
  5958. private function getPool(Composer $composer)
  5959. {
  5960. if (!$this->pool) {
  5961. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5962. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5963. }
  5964. return $this->pool;
  5965. }
  5966. }
  5967. <?php
  5968. namespace Composer\Command;
  5969. use Symfony\Component\Console\Input\InputInterface;
  5970. use Symfony\Component\Console\Input\InputOption;
  5971. use Symfony\Component\Console\Output\OutputInterface;
  5972. use Composer\Downloader\ChangeReportInterface;
  5973. use Composer\Downloader\DvcsDownloaderInterface;
  5974. use Composer\Downloader\VcsCapableDownloaderInterface;
  5975. use Composer\Package\Dumper\ArrayDumper;
  5976. use Composer\Package\Version\VersionGuesser;
  5977. use Composer\Package\Version\VersionParser;
  5978. use Composer\Plugin\CommandEvent;
  5979. use Composer\Plugin\PluginEvents;
  5980. use Composer\Script\ScriptEvents;
  5981. use Composer\Util\ProcessExecutor;
  5982. class StatusCommand extends BaseCommand
  5983. {
  5984. const EXIT_CODE_ERRORS = 1;
  5985. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5986. const EXIT_CODE_VERSION_CHANGES = 4;
  5987. protected function configure()
  5988. {
  5989. $this
  5990. ->setName('status')
  5991. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5992. ->setDefinition(array(
  5993. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5994. ))
  5995. ->setHelp(
  5996. <<<EOT
  5997. The status command displays a list of dependencies that have
  5998. been modified locally.
  5999. Read more at https://getcomposer.org/doc/03-cli.md#status
  6000. EOT
  6001. )
  6002. ;
  6003. }
  6004. protected function execute(InputInterface $input, OutputInterface $output)
  6005. {
  6006. $composer = $this->getComposer();
  6007. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6008. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6009. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6010. $dm = $composer->getDownloadManager();
  6011. $im = $composer->getInstallationManager();
  6012. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6013. $errors = array();
  6014. $io = $this->getIO();
  6015. $unpushedChanges = array();
  6016. $vcsVersionChanges = array();
  6017. $parser = new VersionParser;
  6018. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6019. $dumper = new ArrayDumper;
  6020. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6021. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6022. $targetDir = $im->getInstallPath($package);
  6023. if ($downloader instanceof ChangeReportInterface) {
  6024. if (is_link($targetDir)) {
  6025. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6026. }
  6027. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6028. $errors[$targetDir] = $changes;
  6029. }
  6030. }
  6031. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6032. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6033. switch ($package->getInstallationSource()) {
  6034. case 'source':
  6035. $previousRef = $package->getSourceReference();
  6036. break;
  6037. case 'dist':
  6038. $previousRef = $package->getDistReference();
  6039. break;
  6040. default:
  6041. $previousRef = null;
  6042. }
  6043. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6044. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6045. $vcsVersionChanges[$targetDir] = array(
  6046. 'previous' => array(
  6047. 'version' => $package->getPrettyVersion(),
  6048. 'ref' => $previousRef,
  6049. ),
  6050. 'current' => array(
  6051. 'version' => $currentVersion['pretty_version'],
  6052. 'ref' => $currentVersion['commit'],
  6053. ),
  6054. );
  6055. }
  6056. }
  6057. }
  6058. if ($downloader instanceof DvcsDownloaderInterface) {
  6059. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6060. $unpushedChanges[$targetDir] = $unpushed;
  6061. }
  6062. }
  6063. }
  6064. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6065. $io->writeError('<info>No local changes</info>');
  6066. return 0;
  6067. }
  6068. if ($errors) {
  6069. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6070. foreach ($errors as $path => $changes) {
  6071. if ($input->getOption('verbose')) {
  6072. $indentedChanges = implode("\n", array_map(function ($line) {
  6073. return ' ' . ltrim($line);
  6074. }, explode("\n", $changes)));
  6075. $io->write('<info>'.$path.'</info>:');
  6076. $io->write($indentedChanges);
  6077. } else {
  6078. $io->write($path);
  6079. }
  6080. }
  6081. }
  6082. if ($unpushedChanges) {
  6083. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6084. foreach ($unpushedChanges as $path => $changes) {
  6085. if ($input->getOption('verbose')) {
  6086. $indentedChanges = implode("\n", array_map(function ($line) {
  6087. return ' ' . ltrim($line);
  6088. }, explode("\n", $changes)));
  6089. $io->write('<info>'.$path.'</info>:');
  6090. $io->write($indentedChanges);
  6091. } else {
  6092. $io->write($path);
  6093. }
  6094. }
  6095. }
  6096. if ($vcsVersionChanges) {
  6097. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6098. foreach ($vcsVersionChanges as $path => $changes) {
  6099. if ($input->getOption('verbose')) {
  6100. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6101. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6102. if ($io->isVeryVerbose()) {
  6103. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6104. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6105. }
  6106. $io->write('<info>'.$path.'</info>:');
  6107. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6108. } else {
  6109. $io->write($path);
  6110. }
  6111. }
  6112. }
  6113. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6114. $io->writeError('Use --verbose (-v) to see a list of files');
  6115. }
  6116. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6117. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6118. }
  6119. }
  6120. <?php
  6121. namespace Composer\Command;
  6122. use Composer\Repository\PlatformRepository;
  6123. use Symfony\Component\Console\Input\InputArgument;
  6124. use Symfony\Component\Console\Input\InputInterface;
  6125. use Symfony\Component\Console\Input\InputOption;
  6126. use Symfony\Component\Console\Output\OutputInterface;
  6127. class SuggestsCommand extends BaseCommand
  6128. {
  6129. protected function configure()
  6130. {
  6131. $this
  6132. ->setName('suggests')
  6133. ->setDescription('Shows package suggestions.')
  6134. ->setDefinition(array(
  6135. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6136. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6137. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6138. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6139. ))
  6140. ->setHelp(
  6141. <<<EOT
  6142. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6143. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6144. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6145. EOT
  6146. )
  6147. ;
  6148. }
  6149. protected function execute(InputInterface $input, OutputInterface $output)
  6150. {
  6151. $lock = $this->getComposer()->getLocker()->getLockData();
  6152. if (empty($lock)) {
  6153. throw new \RuntimeException('Lockfile seems to be empty?');
  6154. }
  6155. $packages = $lock['packages'];
  6156. if (!$input->getOption('no-dev')) {
  6157. $packages += $lock['packages-dev'];
  6158. }
  6159. $filter = $input->getArgument('packages');
  6160. $installed = array();
  6161. foreach ($packages as $package) {
  6162. $installed[] = $package['name'];
  6163. if (!empty($package['provide'])) {
  6164. $installed = array_merge($installed, array_keys($package['provide']));
  6165. }
  6166. if (!empty($package['replace'])) {
  6167. $installed = array_merge($installed, array_keys($package['replace']));
  6168. }
  6169. }
  6170. $installed = array_flip($installed);
  6171. ksort($installed);
  6172. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6173. $suggesters = array();
  6174. $suggested = array();
  6175. foreach ($packages as $package) {
  6176. $packageName = $package['name'];
  6177. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6178. continue;
  6179. }
  6180. foreach ($package['suggest'] as $suggestion => $reason) {
  6181. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6182. continue;
  6183. }
  6184. if (!isset($installed[$suggestion])) {
  6185. $suggesters[$packageName][$suggestion] = $reason;
  6186. $suggested[$suggestion][$packageName] = $reason;
  6187. }
  6188. }
  6189. }
  6190. ksort($suggesters);
  6191. ksort($suggested);
  6192. $mode = 0;
  6193. $io = $this->getIO();
  6194. if ($input->getOption('by-package') || $io->isVerbose()) {
  6195. $mode |= 1;
  6196. }
  6197. if ($input->getOption('by-suggestion')) {
  6198. $mode |= 2;
  6199. }
  6200. if ($mode === 0) {
  6201. foreach (array_keys($suggested) as $suggestion) {
  6202. $io->write(sprintf('<info>%s</info>', $suggestion));
  6203. }
  6204. return;
  6205. }
  6206. if ($mode & 1) {
  6207. foreach ($suggesters as $suggester => $suggestions) {
  6208. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6209. foreach ($suggestions as $suggestion => $reason) {
  6210. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6211. }
  6212. $io->write('');
  6213. }
  6214. }
  6215. if ($mode & 2) {
  6216. if ($mode & 1) {
  6217. $io->write(str_repeat('-', 78));
  6218. }
  6219. foreach ($suggested as $suggestion => $suggesters) {
  6220. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6221. foreach ($suggesters as $suggester => $reason) {
  6222. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6223. }
  6224. $io->write('');
  6225. }
  6226. }
  6227. }
  6228. }
  6229. <?php
  6230. namespace Composer\Command;
  6231. use Composer\Composer;
  6232. use Composer\Installer;
  6233. use Composer\IO\IOInterface;
  6234. use Composer\Plugin\CommandEvent;
  6235. use Composer\Plugin\PluginEvents;
  6236. use Symfony\Component\Console\Helper\Table;
  6237. use Symfony\Component\Console\Input\InputInterface;
  6238. use Symfony\Component\Console\Input\InputOption;
  6239. use Symfony\Component\Console\Input\InputArgument;
  6240. use Symfony\Component\Console\Output\OutputInterface;
  6241. use Symfony\Component\Console\Question\Question;
  6242. class UpdateCommand extends BaseCommand
  6243. {
  6244. protected function configure()
  6245. {
  6246. $this
  6247. ->setName('update')
  6248. ->setAliases(array('u', 'upgrade'))
  6249. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6250. ->setDefinition(array(
  6251. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6252. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6253. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6254. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6255. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6256. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6257. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6258. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6259. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6260. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6261. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6262. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6263. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6264. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  6265. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6266. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6267. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6268. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6269. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6270. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6271. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6272. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6273. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6274. ))
  6275. ->setHelp(
  6276. <<<EOT
  6277. The <info>update</info> command reads the composer.json file from the
  6278. current directory, processes it, and updates, removes or installs all the
  6279. dependencies.
  6280. <info>php composer.phar update</info>
  6281. To limit the update operation to a few packages, you can list the package(s)
  6282. you want to update as such:
  6283. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6284. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6285. from a specific vendor:
  6286. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6287. To select packages names interactively with auto-completion use <info>-i</info>.
  6288. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6289. EOT
  6290. )
  6291. ;
  6292. }
  6293. protected function execute(InputInterface $input, OutputInterface $output)
  6294. {
  6295. $io = $this->getIO();
  6296. if ($input->getOption('no-custom-installers')) {
  6297. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6298. $input->setOption('no-plugins', true);
  6299. }
  6300. if ($input->getOption('dev')) {
  6301. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6302. }
  6303. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6304. $packages = $input->getArgument('packages');
  6305. if ($input->getOption('interactive')) {
  6306. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6307. }
  6308. if ($input->getOption('root-reqs')) {
  6309. $require = array_keys($composer->getPackage()->getRequires());
  6310. if (!$input->getOption('no-dev')) {
  6311. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6312. $require = array_merge($require, $requireDev);
  6313. }
  6314. if (!empty($packages)) {
  6315. $packages = array_intersect($packages, $require);
  6316. } else {
  6317. $packages = $require;
  6318. }
  6319. }
  6320. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6321. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6322. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6323. $install = Installer::create($io, $composer);
  6324. $config = $composer->getConfig();
  6325. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6326. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6327. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6328. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6329. $install
  6330. ->setDryRun($input->getOption('dry-run'))
  6331. ->setVerbose($input->getOption('verbose'))
  6332. ->setPreferSource($preferSource)
  6333. ->setPreferDist($preferDist)
  6334. ->setDevMode(!$input->getOption('no-dev'))
  6335. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6336. ->setRunScripts(!$input->getOption('no-scripts'))
  6337. ->setSkipSuggest($input->getOption('no-suggest'))
  6338. ->setOptimizeAutoloader($optimize)
  6339. ->setClassMapAuthoritative($authoritative)
  6340. ->setApcuAutoloader($apcu)
  6341. ->setUpdate(true)
  6342. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6343. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6344. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6345. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6346. ->setPreferStable($input->getOption('prefer-stable'))
  6347. ->setPreferLowest($input->getOption('prefer-lowest'))
  6348. ;
  6349. if ($input->getOption('no-plugins')) {
  6350. $install->disablePlugins();
  6351. }
  6352. return $install->run();
  6353. }
  6354. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6355. {
  6356. if (!$input->isInteractive()) {
  6357. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6358. }
  6359. $requires = array_merge(
  6360. $composer->getPackage()->getRequires(),
  6361. $composer->getPackage()->getDevRequires()
  6362. );
  6363. $autocompleterValues = array();
  6364. foreach ($requires as $require) {
  6365. $target = $require->getTarget();
  6366. $autocompleterValues[strtolower($target)] = $target;
  6367. }
  6368. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6369. foreach ($installedPackages as $package) {
  6370. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6371. }
  6372. $helper = $this->getHelper('question');
  6373. $question = new Question('<comment>Enter package name: </comment>', null);
  6374. $io->writeError('<info>Press enter without value to end submission</info>');
  6375. do {
  6376. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6377. $question->setAutocompleterValues($autocompleterValues);
  6378. $addedPackage = $helper->ask($input, $output, $question);
  6379. if (!is_string($addedPackage) || empty($addedPackage)) {
  6380. break;
  6381. }
  6382. $addedPackage = strtolower($addedPackage);
  6383. if (!in_array($addedPackage, $packages)) {
  6384. $packages[] = $addedPackage;
  6385. }
  6386. } while (true);
  6387. $packages = array_filter($packages);
  6388. if (!$packages) {
  6389. throw new \InvalidArgumentException('You must enter minimum one package.');
  6390. }
  6391. $table = new Table($output);
  6392. $table->setHeaders(array('Selected packages'));
  6393. foreach ($packages as $package) {
  6394. $table->addRow(array($package));
  6395. }
  6396. $table->render();
  6397. if ($io->askConfirmation(sprintf(
  6398. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6399. 1 === count($packages) ? '' : 's'
  6400. ), true)) {
  6401. return $packages;
  6402. }
  6403. throw new \RuntimeException('Installation aborted.');
  6404. }
  6405. }
  6406. <?php
  6407. namespace Composer\Command;
  6408. use Composer\Factory;
  6409. use Composer\Package\Loader\ValidatingArrayLoader;
  6410. use Composer\Plugin\CommandEvent;
  6411. use Composer\Plugin\PluginEvents;
  6412. use Composer\Util\ConfigValidator;
  6413. use Symfony\Component\Console\Input\InputArgument;
  6414. use Symfony\Component\Console\Input\InputInterface;
  6415. use Symfony\Component\Console\Input\InputOption;
  6416. use Symfony\Component\Console\Output\OutputInterface;
  6417. class ValidateCommand extends BaseCommand
  6418. {
  6419. protected function configure()
  6420. {
  6421. $this
  6422. ->setName('validate')
  6423. ->setDescription('Validates a composer.json and composer.lock.')
  6424. ->setDefinition(array(
  6425. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  6426. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6427. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6428. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6429. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6430. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6431. ))
  6432. ->setHelp(
  6433. <<<EOT
  6434. The validate command validates a given composer.json and composer.lock
  6435. Exit codes in case of errors are:
  6436. 1 validation warning(s), only when --strict is given
  6437. 2 validation error(s)
  6438. 3 file unreadable or missing
  6439. Read more at https://getcomposer.org/doc/03-cli.md#validate
  6440. EOT
  6441. );
  6442. }
  6443. protected function execute(InputInterface $input, OutputInterface $output)
  6444. {
  6445. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6446. $io = $this->getIO();
  6447. if (!file_exists($file)) {
  6448. $io->writeError('<error>' . $file . ' not found.</error>');
  6449. return 3;
  6450. }
  6451. if (!is_readable($file)) {
  6452. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6453. return 3;
  6454. }
  6455. $validator = new ConfigValidator($io);
  6456. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6457. $checkPublish = !$input->getOption('no-check-publish');
  6458. $checkLock = !$input->getOption('no-check-lock');
  6459. $isStrict = $input->getOption('strict');
  6460. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6461. $lockErrors = array();
  6462. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6463. $locker = $composer->getLocker();
  6464. if ($locker->isLocked() && !$locker->isFresh()) {
  6465. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6466. }
  6467. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true, $isStrict);
  6468. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6469. if ($input->getOption('with-dependencies')) {
  6470. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6471. foreach ($localRepo->getPackages() as $package) {
  6472. $path = $composer->getInstallationManager()->getInstallPath($package);
  6473. $file = $path . '/composer.json';
  6474. if (is_dir($path) && file_exists($file)) {
  6475. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6476. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6477. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6478. $exitCode = max($depCode, $exitCode);
  6479. }
  6480. }
  6481. }
  6482. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6483. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6484. $exitCode = max($eventCode, $exitCode);
  6485. return $exitCode;
  6486. }
  6487. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
  6488. {
  6489. if (!$errors && !$publishErrors && !$warnings) {
  6490. $io->write('<info>' . $name . ' is valid</info>');
  6491. } elseif (!$errors && !$publishErrors) {
  6492. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6493. if ($printSchemaUrl) {
  6494. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6495. }
  6496. } elseif (!$errors) {
  6497. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6498. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6499. if ($printSchemaUrl) {
  6500. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6501. }
  6502. } else {
  6503. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6504. }
  6505. if ($checkPublish) {
  6506. $errors = array_merge($errors, $publishErrors);
  6507. } elseif (!$isStrict) {
  6508. $warnings = array_merge($warnings, $publishErrors);
  6509. }
  6510. if ($checkLock) {
  6511. $errors = array_merge($errors, $lockErrors);
  6512. } elseif (!$isStrict) {
  6513. $warnings = array_merge($warnings, $lockErrors);
  6514. }
  6515. $messages = array(
  6516. 'error' => $errors,
  6517. 'warning' => $warnings,
  6518. );
  6519. foreach ($messages as $style => $msgs) {
  6520. foreach ($msgs as $msg) {
  6521. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6522. }
  6523. }
  6524. }
  6525. }
  6526. <?php
  6527. namespace Composer;
  6528. use Composer\Package\RootPackageInterface;
  6529. use Composer\Package\Locker;
  6530. use Composer\Repository\RepositoryManager;
  6531. use Composer\Installer\InstallationManager;
  6532. use Composer\Plugin\PluginManager;
  6533. use Composer\Downloader\DownloadManager;
  6534. use Composer\EventDispatcher\EventDispatcher;
  6535. use Composer\Autoload\AutoloadGenerator;
  6536. use Composer\Package\Archiver\ArchiveManager;
  6537. class Composer
  6538. {
  6539. const VERSION = '1.9.0';
  6540. const BRANCH_ALIAS_VERSION = '';
  6541. const RELEASE_DATE = '2019-08-02 20:55:32';
  6542. const SOURCE_VERSION = '';
  6543. public static function getVersion()
  6544. {
  6545. if (self::VERSION === '@package_version'.'@') {
  6546. return self::SOURCE_VERSION;
  6547. }
  6548. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  6549. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  6550. }
  6551. return self::VERSION;
  6552. }
  6553. private $package;
  6554. private $locker;
  6555. private $repositoryManager;
  6556. private $downloadManager;
  6557. private $installationManager;
  6558. private $pluginManager;
  6559. private $config;
  6560. private $eventDispatcher;
  6561. private $autoloadGenerator;
  6562. private $archiveManager;
  6563. public function setPackage(RootPackageInterface $package)
  6564. {
  6565. $this->package = $package;
  6566. }
  6567. public function getPackage()
  6568. {
  6569. return $this->package;
  6570. }
  6571. public function setConfig(Config $config)
  6572. {
  6573. $this->config = $config;
  6574. }
  6575. public function getConfig()
  6576. {
  6577. return $this->config;
  6578. }
  6579. public function setLocker(Locker $locker)
  6580. {
  6581. $this->locker = $locker;
  6582. }
  6583. public function getLocker()
  6584. {
  6585. return $this->locker;
  6586. }
  6587. public function setRepositoryManager(RepositoryManager $manager)
  6588. {
  6589. $this->repositoryManager = $manager;
  6590. }
  6591. public function getRepositoryManager()
  6592. {
  6593. return $this->repositoryManager;
  6594. }
  6595. public function setDownloadManager(DownloadManager $manager)
  6596. {
  6597. $this->downloadManager = $manager;
  6598. }
  6599. public function getDownloadManager()
  6600. {
  6601. return $this->downloadManager;
  6602. }
  6603. public function setArchiveManager(ArchiveManager $manager)
  6604. {
  6605. $this->archiveManager = $manager;
  6606. }
  6607. public function getArchiveManager()
  6608. {
  6609. return $this->archiveManager;
  6610. }
  6611. public function setInstallationManager(InstallationManager $manager)
  6612. {
  6613. $this->installationManager = $manager;
  6614. }
  6615. public function getInstallationManager()
  6616. {
  6617. return $this->installationManager;
  6618. }
  6619. public function setPluginManager(PluginManager $manager)
  6620. {
  6621. $this->pluginManager = $manager;
  6622. }
  6623. public function getPluginManager()
  6624. {
  6625. return $this->pluginManager;
  6626. }
  6627. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6628. {
  6629. $this->eventDispatcher = $eventDispatcher;
  6630. }
  6631. public function getEventDispatcher()
  6632. {
  6633. return $this->eventDispatcher;
  6634. }
  6635. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6636. {
  6637. $this->autoloadGenerator = $autoloadGenerator;
  6638. }
  6639. public function getAutoloadGenerator()
  6640. {
  6641. return $this->autoloadGenerator;
  6642. }
  6643. }
  6644. <?php
  6645. namespace Composer;
  6646. use Composer\Config\ConfigSourceInterface;
  6647. use Composer\Downloader\TransportException;
  6648. use Composer\IO\IOInterface;
  6649. use Composer\Util\Platform;
  6650. use Composer\Util\ProcessExecutor;
  6651. class Config
  6652. {
  6653. const RELATIVE_PATHS = 1;
  6654. public static $defaultConfig = array(
  6655. 'process-timeout' => 300,
  6656. 'use-include-path' => false,
  6657. 'preferred-install' => 'auto',
  6658. 'notify-on-install' => true,
  6659. 'github-protocols' => array('https', 'ssh', 'git'),
  6660. 'vendor-dir' => 'vendor',
  6661. 'bin-dir' => '{$vendor-dir}/bin',
  6662. 'cache-dir' => '{$home}/cache',
  6663. 'data-dir' => '{$home}',
  6664. 'cache-files-dir' => '{$cache-dir}/files',
  6665. 'cache-repo-dir' => '{$cache-dir}/repo',
  6666. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6667. 'cache-ttl' => 15552000,
  6668. 'cache-files-ttl' => null,
  6669. 'cache-files-maxsize' => '300MiB',
  6670. 'bin-compat' => 'auto',
  6671. 'discard-changes' => false,
  6672. 'autoloader-suffix' => null,
  6673. 'sort-packages' => false,
  6674. 'optimize-autoloader' => false,
  6675. 'classmap-authoritative' => false,
  6676. 'apcu-autoloader' => false,
  6677. 'prepend-autoloader' => true,
  6678. 'github-domains' => array('github.com'),
  6679. 'bitbucket-expose-hostname' => true,
  6680. 'disable-tls' => false,
  6681. 'secure-http' => true,
  6682. 'cafile' => null,
  6683. 'capath' => null,
  6684. 'github-expose-hostname' => true,
  6685. 'gitlab-domains' => array('gitlab.com'),
  6686. 'store-auths' => 'prompt',
  6687. 'platform' => array(),
  6688. 'archive-format' => 'tar',
  6689. 'archive-dir' => '.',
  6690. 'htaccess-protect' => true,
  6691. 'use-github-api' => true,
  6692. );
  6693. public static $defaultRepositories = array(
  6694. 'packagist.org' => array(
  6695. 'type' => 'composer',
  6696. 'url' => 'https?://repo.packagist.org',
  6697. 'allow_ssl_downgrade' => true,
  6698. ),
  6699. );
  6700. private $config;
  6701. private $baseDir;
  6702. private $repositories;
  6703. private $configSource;
  6704. private $authConfigSource;
  6705. private $useEnvironment;
  6706. private $warnedHosts = array();
  6707. public function __construct($useEnvironment = true, $baseDir = null)
  6708. {
  6709. $this->config = static::$defaultConfig;
  6710. $this->repositories = static::$defaultRepositories;
  6711. $this->useEnvironment = (bool) $useEnvironment;
  6712. $this->baseDir = $baseDir;
  6713. }
  6714. public function setConfigSource(ConfigSourceInterface $source)
  6715. {
  6716. $this->configSource = $source;
  6717. }
  6718. public function getConfigSource()
  6719. {
  6720. return $this->configSource;
  6721. }
  6722. public function setAuthConfigSource(ConfigSourceInterface $source)
  6723. {
  6724. $this->authConfigSource = $source;
  6725. }
  6726. public function getAuthConfigSource()
  6727. {
  6728. return $this->authConfigSource;
  6729. }
  6730. public function merge($config)
  6731. {
  6732. if (!empty($config['config']) && is_array($config['config'])) {
  6733. foreach ($config['config'] as $key => $val) {
  6734. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6735. $this->config[$key] = array_merge($this->config[$key], $val);
  6736. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6737. if (is_array($val) || is_array($this->config[$key])) {
  6738. if (is_string($val)) {
  6739. $val = array('*' => $val);
  6740. }
  6741. if (is_string($this->config[$key])) {
  6742. $this->config[$key] = array('*' => $this->config[$key]);
  6743. }
  6744. $this->config[$key] = array_merge($this->config[$key], $val);
  6745. if (isset($this->config[$key]['*'])) {
  6746. $wildcard = $this->config[$key]['*'];
  6747. unset($this->config[$key]['*']);
  6748. $this->config[$key]['*'] = $wildcard;
  6749. }
  6750. } else {
  6751. $this->config[$key] = $val;
  6752. }
  6753. } else {
  6754. $this->config[$key] = $val;
  6755. }
  6756. }
  6757. }
  6758. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6759. $this->repositories = array_reverse($this->repositories, true);
  6760. $newRepos = array_reverse($config['repositories'], true);
  6761. foreach ($newRepos as $name => $repository) {
  6762. if (false === $repository) {
  6763. $this->disableRepoByName($name);
  6764. continue;
  6765. }
  6766. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6767. $this->disableRepoByName(key($repository));
  6768. continue;
  6769. }
  6770. if (is_int($name)) {
  6771. $this->repositories[] = $repository;
  6772. } else {
  6773. if ($name === 'packagist') {
  6774. $this->repositories[$name . '.org'] = $repository;
  6775. } else {
  6776. $this->repositories[$name] = $repository;
  6777. }
  6778. }
  6779. }
  6780. $this->repositories = array_reverse($this->repositories, true);
  6781. }
  6782. }
  6783. public function getRepositories()
  6784. {
  6785. return $this->repositories;
  6786. }
  6787. public function get($key, $flags = 0)
  6788. {
  6789. switch ($key) {
  6790. case 'vendor-dir':
  6791. case 'bin-dir':
  6792. case 'process-timeout':
  6793. case 'data-dir':
  6794. case 'cache-dir':
  6795. case 'cache-files-dir':
  6796. case 'cache-repo-dir':
  6797. case 'cache-vcs-dir':
  6798. case 'cafile':
  6799. case 'capath':
  6800. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6801. $val = $this->getComposerEnv($env);
  6802. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6803. $val = Platform::expandPath($val);
  6804. if (substr($key, -4) !== '-dir') {
  6805. return $val;
  6806. }
  6807. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6808. case 'htaccess-protect':
  6809. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  6810. if (false === $value) {
  6811. $value = $this->config[$key];
  6812. }
  6813. return $value !== 'false' && (bool) $value;
  6814. case 'cache-ttl':
  6815. return (int) $this->config[$key];
  6816. case 'cache-files-maxsize':
  6817. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6818. throw new \RuntimeException(
  6819. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6820. );
  6821. }
  6822. $size = $matches[1];
  6823. if (isset($matches[2])) {
  6824. switch (strtolower($matches[2])) {
  6825. case 'g':
  6826. $size *= 1024;
  6827. case 'm':
  6828. $size *= 1024;
  6829. case 'k':
  6830. $size *= 1024;
  6831. break;
  6832. }
  6833. }
  6834. return $size;
  6835. case 'cache-files-ttl':
  6836. if (isset($this->config[$key])) {
  6837. return (int) $this->config[$key];
  6838. }
  6839. return (int) $this->config['cache-ttl'];
  6840. case 'home':
  6841. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6842. return rtrim($this->process($val, $flags), '/\\');
  6843. case 'bin-compat':
  6844. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6845. if (!in_array($value, array('auto', 'full'))) {
  6846. throw new \RuntimeException(
  6847. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6848. );
  6849. }
  6850. return $value;
  6851. case 'discard-changes':
  6852. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6853. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6854. throw new \RuntimeException(
  6855. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6856. );
  6857. }
  6858. if ('stash' === $env) {
  6859. return 'stash';
  6860. }
  6861. return $env !== 'false' && (bool) $env;
  6862. }
  6863. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6864. throw new \RuntimeException(
  6865. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6866. );
  6867. }
  6868. return $this->config[$key];
  6869. case 'github-protocols':
  6870. $protos = $this->config['github-protocols'];
  6871. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6872. unset($protos[$index]);
  6873. }
  6874. if (reset($protos) === 'http') {
  6875. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6876. }
  6877. return $protos;
  6878. case 'disable-tls':
  6879. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6880. case 'secure-http':
  6881. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6882. case 'use-github-api':
  6883. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6884. default:
  6885. if (!isset($this->config[$key])) {
  6886. return null;
  6887. }
  6888. return $this->process($this->config[$key], $flags);
  6889. }
  6890. }
  6891. public function all($flags = 0)
  6892. {
  6893. $all = array(
  6894. 'repositories' => $this->getRepositories(),
  6895. );
  6896. foreach (array_keys($this->config) as $key) {
  6897. $all['config'][$key] = $this->get($key, $flags);
  6898. }
  6899. return $all;
  6900. }
  6901. public function raw()
  6902. {
  6903. return array(
  6904. 'repositories' => $this->getRepositories(),
  6905. 'config' => $this->config,
  6906. );
  6907. }
  6908. public function has($key)
  6909. {
  6910. return array_key_exists($key, $this->config);
  6911. }
  6912. private function process($value, $flags)
  6913. {
  6914. $config = $this;
  6915. if (!is_string($value)) {
  6916. return $value;
  6917. }
  6918. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6919. return $config->get($match[1], $flags);
  6920. }, $value);
  6921. }
  6922. private function realpath($path)
  6923. {
  6924. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6925. return $path;
  6926. }
  6927. return $this->baseDir . '/' . $path;
  6928. }
  6929. private function getComposerEnv($var)
  6930. {
  6931. if ($this->useEnvironment) {
  6932. return getenv($var);
  6933. }
  6934. return false;
  6935. }
  6936. private function disableRepoByName($name)
  6937. {
  6938. if (isset($this->repositories[$name])) {
  6939. unset($this->repositories[$name]);
  6940. } elseif ($name === 'packagist') {
  6941. unset($this->repositories['packagist.org']);
  6942. }
  6943. }
  6944. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6945. {
  6946. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6947. return;
  6948. }
  6949. $scheme = parse_url($url, PHP_URL_SCHEME);
  6950. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6951. if ($this->get('secure-http')) {
  6952. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6953. } elseif ($io) {
  6954. $host = parse_url($url, PHP_URL_HOST);
  6955. if (!isset($this->warnedHosts[$host])) {
  6956. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6957. }
  6958. $this->warnedHosts[$host] = true;
  6959. }
  6960. }
  6961. }
  6962. public static function disableProcessTimeout()
  6963. {
  6964. ProcessExecutor::setTimeout(0);
  6965. }
  6966. }
  6967. <?php
  6968. namespace Composer\Config;
  6969. interface ConfigSourceInterface
  6970. {
  6971. public function addRepository($name, $config);
  6972. public function removeRepository($name);
  6973. public function addConfigSetting($name, $value);
  6974. public function removeConfigSetting($name);
  6975. public function addProperty($name, $value);
  6976. public function removeProperty($name);
  6977. public function addLink($type, $name, $value);
  6978. public function removeLink($type, $name);
  6979. public function getName();
  6980. }
  6981. <?php
  6982. namespace Composer\Config;
  6983. use Composer\Json\JsonFile;
  6984. use Composer\Json\JsonManipulator;
  6985. use Composer\Util\Silencer;
  6986. class JsonConfigSource implements ConfigSourceInterface
  6987. {
  6988. private $file;
  6989. private $authConfig;
  6990. public function __construct(JsonFile $file, $authConfig = false)
  6991. {
  6992. $this->file = $file;
  6993. $this->authConfig = $authConfig;
  6994. }
  6995. public function getName()
  6996. {
  6997. return $this->file->getPath();
  6998. }
  6999. public function addRepository($name, $config)
  7000. {
  7001. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7002. if (isset($config['repositories'])) {
  7003. foreach ($config['repositories'] as $index => $val) {
  7004. if ($index === $repo) {
  7005. continue;
  7006. }
  7007. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7008. unset($config['repositories'][$index]);
  7009. $config['repositories']['packagist.org'] = false;
  7010. break;
  7011. }
  7012. }
  7013. }
  7014. $config['repositories'][$repo] = $repoConfig;
  7015. });
  7016. }
  7017. public function removeRepository($name)
  7018. {
  7019. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7020. unset($config['repositories'][$repo]);
  7021. });
  7022. }
  7023. public function addConfigSetting($name, $value)
  7024. {
  7025. $authConfig = $this->authConfig;
  7026. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7027. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7028. list($key, $host) = explode('.', $key, 2);
  7029. if ($authConfig) {
  7030. $config[$key][$host] = $val;
  7031. } else {
  7032. $config['config'][$key][$host] = $val;
  7033. }
  7034. } else {
  7035. $config['config'][$key] = $val;
  7036. }
  7037. });
  7038. }
  7039. public function removeConfigSetting($name)
  7040. {
  7041. $authConfig = $this->authConfig;
  7042. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7043. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7044. list($key, $host) = explode('.', $key, 2);
  7045. if ($authConfig) {
  7046. unset($config[$key][$host]);
  7047. } else {
  7048. unset($config['config'][$key][$host]);
  7049. }
  7050. } else {
  7051. unset($config['config'][$key]);
  7052. }
  7053. });
  7054. }
  7055. public function addProperty($name, $value)
  7056. {
  7057. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7058. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7059. $bits = explode('.', $key);
  7060. $last = array_pop($bits);
  7061. $arr = &$config[reset($bits)];
  7062. foreach ($bits as $bit) {
  7063. if (!isset($arr[$bit])) {
  7064. $arr[$bit] = array();
  7065. }
  7066. $arr = &$arr[$bit];
  7067. }
  7068. $arr[$last] = $val;
  7069. } else {
  7070. $config[$key] = $val;
  7071. }
  7072. });
  7073. }
  7074. public function removeProperty($name)
  7075. {
  7076. $authConfig = $this->authConfig;
  7077. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7078. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7079. $bits = explode('.', $key);
  7080. $last = array_pop($bits);
  7081. $arr = &$config[reset($bits)];
  7082. foreach ($bits as $bit) {
  7083. if (!isset($arr[$bit])) {
  7084. return;
  7085. }
  7086. $arr = &$arr[$bit];
  7087. }
  7088. unset($arr[$last]);
  7089. } else {
  7090. unset($config[$key]);
  7091. }
  7092. });
  7093. }
  7094. public function addLink($type, $name, $value)
  7095. {
  7096. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7097. $config[$type][$name] = $value;
  7098. });
  7099. }
  7100. public function removeLink($type, $name)
  7101. {
  7102. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7103. unset($config[$type][$name]);
  7104. if (0 === count($config[$type])) {
  7105. unset($config[$type]);
  7106. }
  7107. });
  7108. }
  7109. protected function manipulateJson($method, $args, $fallback)
  7110. {
  7111. $args = func_get_args();
  7112. array_shift($args);
  7113. $fallback = array_pop($args);
  7114. if ($this->file->exists()) {
  7115. if (!is_writable($this->file->getPath())) {
  7116. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7117. }
  7118. if (!is_readable($this->file->getPath())) {
  7119. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7120. }
  7121. $contents = file_get_contents($this->file->getPath());
  7122. } elseif ($this->authConfig) {
  7123. $contents = "{\n}\n";
  7124. } else {
  7125. $contents = "{\n \"config\": {\n }\n}\n";
  7126. }
  7127. $manipulator = new JsonManipulator($contents);
  7128. $newFile = !$this->file->exists();
  7129. if ($this->authConfig && $method === 'addConfigSetting') {
  7130. $method = 'addSubNode';
  7131. list($mainNode, $name) = explode('.', $args[0], 2);
  7132. $args = array($mainNode, $name, $args[1]);
  7133. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7134. $method = 'removeSubNode';
  7135. list($mainNode, $name) = explode('.', $args[0], 2);
  7136. $args = array($mainNode, $name);
  7137. }
  7138. if (call_user_func_array(array($manipulator, $method), $args)) {
  7139. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7140. } else {
  7141. $config = $this->file->read();
  7142. $this->arrayUnshiftRef($args, $config);
  7143. call_user_func_array($fallback, $args);
  7144. $this->file->write($config);
  7145. }
  7146. if ($newFile) {
  7147. Silencer::call('chmod', $this->file->getPath(), 0600);
  7148. }
  7149. }
  7150. private function arrayUnshiftRef(&$array, &$value)
  7151. {
  7152. $return = array_unshift($array, '');
  7153. $array[0] = &$value;
  7154. return $return;
  7155. }
  7156. }
  7157. <?php
  7158. namespace Composer\Console;
  7159. use Composer\IO\NullIO;
  7160. use Composer\Util\Platform;
  7161. use Composer\Util\Silencer;
  7162. use Symfony\Component\Console\Application as BaseApplication;
  7163. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7164. use Symfony\Component\Console\Helper\HelperSet;
  7165. use Symfony\Component\Console\Helper\QuestionHelper;
  7166. use Symfony\Component\Console\Input\InputInterface;
  7167. use Symfony\Component\Console\Input\InputOption;
  7168. use Symfony\Component\Console\Output\OutputInterface;
  7169. use Composer\Command;
  7170. use Composer\Composer;
  7171. use Composer\Factory;
  7172. use Composer\IO\IOInterface;
  7173. use Composer\IO\ConsoleIO;
  7174. use Composer\Json\JsonValidationException;
  7175. use Composer\Util\ErrorHandler;
  7176. use Composer\EventDispatcher\ScriptExecutionException;
  7177. use Composer\Exception\NoSslException;
  7178. class Application extends BaseApplication
  7179. {
  7180. protected $composer;
  7181. protected $io;
  7182. private static $logo = ' ______
  7183. / ____/___ ____ ___ ____ ____ ________ _____
  7184. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7185. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7186. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7187. /_/
  7188. ';
  7189. private $hasPluginCommands = false;
  7190. private $disablePluginsByDefault = false;
  7191. public function __construct()
  7192. {
  7193. static $shutdownRegistered = false;
  7194. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7195. ini_set('xdebug.show_exception_trace', false);
  7196. ini_set('xdebug.scream', false);
  7197. }
  7198. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7199. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7200. }
  7201. if (!$shutdownRegistered) {
  7202. $shutdownRegistered = true;
  7203. register_shutdown_function(function () {
  7204. $lastError = error_get_last();
  7205. if ($lastError && $lastError['message'] &&
  7206. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7207. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7208. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7209. }
  7210. });
  7211. }
  7212. $this->io = new NullIO();
  7213. parent::__construct('Composer', Composer::getVersion());
  7214. }
  7215. public function run(InputInterface $input = null, OutputInterface $output = null)
  7216. {
  7217. if (null === $output) {
  7218. $output = Factory::createOutput();
  7219. }
  7220. return parent::run($input, $output);
  7221. }
  7222. public function doRun(InputInterface $input, OutputInterface $output)
  7223. {
  7224. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7225. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7226. new QuestionHelper(),
  7227. )));
  7228. ErrorHandler::register($io);
  7229. if ($input->hasParameterOption('--no-cache')) {
  7230. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7231. putenv('COMPOSER_CACHE_DIR='.(Platform::isWindows() ? 'nul' : '/dev/null'));
  7232. }
  7233. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7234. $oldWorkingDir = getcwd();
  7235. chdir($newWorkDir);
  7236. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7237. }
  7238. $commandName = '';
  7239. if ($name = $this->getCommandName($input)) {
  7240. try {
  7241. $commandName = $this->find($name)->getName();
  7242. } catch (CommandNotFoundException $e) {
  7243. $commandName = false;
  7244. } catch (\InvalidArgumentException $e) {
  7245. }
  7246. }
  7247. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7248. $dir = dirname(getcwd());
  7249. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7250. while (dirname($dir) !== $dir && $dir !== $home) {
  7251. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7252. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7253. $oldWorkingDir = getcwd();
  7254. chdir($dir);
  7255. }
  7256. break;
  7257. }
  7258. $dir = dirname($dir);
  7259. }
  7260. }
  7261. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7262. try {
  7263. foreach ($this->getPluginCommands() as $command) {
  7264. if ($this->has($command->getName())) {
  7265. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7266. } else {
  7267. $this->add($command);
  7268. }
  7269. }
  7270. } catch (NoSslException $e) {
  7271. }
  7272. $this->hasPluginCommands = true;
  7273. }
  7274. $isProxyCommand = false;
  7275. if ($name = $this->getCommandName($input)) {
  7276. try {
  7277. $command = $this->find($name);
  7278. $commandName = $command->getName();
  7279. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7280. } catch (\InvalidArgumentException $e) {
  7281. }
  7282. }
  7283. if (!$isProxyCommand) {
  7284. $io->writeError(sprintf(
  7285. 'Running %s (%s) with %s on %s',
  7286. Composer::getVersion(),
  7287. Composer::RELEASE_DATE,
  7288. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7289. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7290. ), true, IOInterface::DEBUG);
  7291. if (PHP_VERSION_ID < 50302) {
  7292. $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>');
  7293. }
  7294. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7295. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7296. }
  7297. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7298. $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']));
  7299. }
  7300. if (getenv('COMPOSER_NO_INTERACTION')) {
  7301. $input->setInteractive(false);
  7302. }
  7303. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  7304. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7305. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7306. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7307. }
  7308. if ($uid = (int) getenv('SUDO_UID')) {
  7309. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7310. }
  7311. }
  7312. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7313. }
  7314. Silencer::call(function () use ($io) {
  7315. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7316. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7317. $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()));
  7318. }
  7319. });
  7320. $file = Factory::getComposerFile();
  7321. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7322. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7323. foreach ($composer['scripts'] as $script => $dummy) {
  7324. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7325. if ($this->has($script)) {
  7326. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7327. } else {
  7328. $description = null;
  7329. if (isset($composer['scripts-descriptions'][$script])) {
  7330. $description = $composer['scripts-descriptions'][$script];
  7331. }
  7332. $this->add(new Command\ScriptAliasCommand($script, $description));
  7333. }
  7334. }
  7335. }
  7336. }
  7337. }
  7338. }
  7339. try {
  7340. if ($input->hasParameterOption('--profile')) {
  7341. $startTime = microtime(true);
  7342. $this->io->enableDebugging($startTime);
  7343. }
  7344. $result = parent::doRun($input, $output);
  7345. if (isset($oldWorkingDir)) {
  7346. chdir($oldWorkingDir);
  7347. }
  7348. if (isset($startTime)) {
  7349. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7350. }
  7351. restore_error_handler();
  7352. return $result;
  7353. } catch (ScriptExecutionException $e) {
  7354. return $e->getCode();
  7355. } catch (\Exception $e) {
  7356. $this->hintCommonErrors($e);
  7357. restore_error_handler();
  7358. throw $e;
  7359. }
  7360. }
  7361. private function getNewWorkingDir(InputInterface $input)
  7362. {
  7363. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7364. if (false !== $workingDir && !is_dir($workingDir)) {
  7365. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7366. }
  7367. return $workingDir;
  7368. }
  7369. private function hintCommonErrors($exception)
  7370. {
  7371. $io = $this->getIO();
  7372. Silencer::suppress();
  7373. try {
  7374. $composer = $this->getComposer(false, true);
  7375. if ($composer) {
  7376. $config = $composer->getConfig();
  7377. $minSpaceFree = 1024 * 1024;
  7378. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7379. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7380. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7381. ) {
  7382. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7383. }
  7384. }
  7385. } catch (\Exception $e) {
  7386. }
  7387. Silencer::restore();
  7388. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7389. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7390. $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);
  7391. }
  7392. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7393. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7394. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7395. }
  7396. }
  7397. public function getComposer($required = true, $disablePlugins = null)
  7398. {
  7399. if (null === $disablePlugins) {
  7400. $disablePlugins = $this->disablePluginsByDefault;
  7401. }
  7402. if (null === $this->composer) {
  7403. try {
  7404. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7405. } catch (\InvalidArgumentException $e) {
  7406. if ($required) {
  7407. $this->io->writeError($e->getMessage());
  7408. exit(1);
  7409. }
  7410. } catch (JsonValidationException $e) {
  7411. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7412. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7413. throw new JsonValidationException($message);
  7414. }
  7415. }
  7416. return $this->composer;
  7417. }
  7418. public function resetComposer()
  7419. {
  7420. $this->composer = null;
  7421. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  7422. $this->getIO()->resetAuthentications();
  7423. }
  7424. }
  7425. public function getIO()
  7426. {
  7427. return $this->io;
  7428. }
  7429. public function getHelp()
  7430. {
  7431. return self::$logo . parent::getHelp();
  7432. }
  7433. protected function getDefaultCommands()
  7434. {
  7435. $commands = array_merge(parent::getDefaultCommands(), array(
  7436. new Command\AboutCommand(),
  7437. new Command\ConfigCommand(),
  7438. new Command\DependsCommand(),
  7439. new Command\ProhibitsCommand(),
  7440. new Command\InitCommand(),
  7441. new Command\InstallCommand(),
  7442. new Command\CreateProjectCommand(),
  7443. new Command\UpdateCommand(),
  7444. new Command\SearchCommand(),
  7445. new Command\ValidateCommand(),
  7446. new Command\ShowCommand(),
  7447. new Command\SuggestsCommand(),
  7448. new Command\RequireCommand(),
  7449. new Command\DumpAutoloadCommand(),
  7450. new Command\StatusCommand(),
  7451. new Command\ArchiveCommand(),
  7452. new Command\DiagnoseCommand(),
  7453. new Command\RunScriptCommand(),
  7454. new Command\LicensesCommand(),
  7455. new Command\GlobalCommand(),
  7456. new Command\ClearCacheCommand(),
  7457. new Command\RemoveCommand(),
  7458. new Command\HomeCommand(),
  7459. new Command\ExecCommand(),
  7460. new Command\OutdatedCommand(),
  7461. new Command\CheckPlatformReqsCommand(),
  7462. ));
  7463. if ('phar:' === substr(__FILE__, 0, 5)) {
  7464. $commands[] = new Command\SelfUpdateCommand();
  7465. }
  7466. return $commands;
  7467. }
  7468. public function getLongVersion()
  7469. {
  7470. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  7471. return sprintf(
  7472. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7473. $this->getName(),
  7474. Composer::BRANCH_ALIAS_VERSION,
  7475. $this->getVersion(),
  7476. Composer::RELEASE_DATE
  7477. );
  7478. }
  7479. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7480. }
  7481. protected function getDefaultInputDefinition()
  7482. {
  7483. $definition = parent::getDefaultInputDefinition();
  7484. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7485. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7486. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7487. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  7488. return $definition;
  7489. }
  7490. private function getPluginCommands()
  7491. {
  7492. $commands = array();
  7493. $composer = $this->getComposer(false, false);
  7494. if (null === $composer) {
  7495. $composer = Factory::createGlobal($this->io, false);
  7496. }
  7497. if (null !== $composer) {
  7498. $pm = $composer->getPluginManager();
  7499. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7500. $newCommands = $capability->getCommands();
  7501. if (!is_array($newCommands)) {
  7502. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7503. }
  7504. foreach ($newCommands as $command) {
  7505. if (!$command instanceof Command\BaseCommand) {
  7506. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7507. }
  7508. }
  7509. $commands = array_merge($commands, $newCommands);
  7510. }
  7511. }
  7512. return $commands;
  7513. }
  7514. }
  7515. <?php
  7516. namespace Composer\Console;
  7517. use Symfony\Component\Console\Formatter\OutputFormatter;
  7518. class HtmlOutputFormatter extends OutputFormatter
  7519. {
  7520. private static $availableForegroundColors = array(
  7521. 30 => 'black',
  7522. 31 => 'red',
  7523. 32 => 'green',
  7524. 33 => 'yellow',
  7525. 34 => 'blue',
  7526. 35 => 'magenta',
  7527. 36 => 'cyan',
  7528. 37 => 'white',
  7529. );
  7530. private static $availableBackgroundColors = array(
  7531. 40 => 'black',
  7532. 41 => 'red',
  7533. 42 => 'green',
  7534. 43 => 'yellow',
  7535. 44 => 'blue',
  7536. 45 => 'magenta',
  7537. 46 => 'cyan',
  7538. 47 => 'white',
  7539. );
  7540. private static $availableOptions = array(
  7541. 1 => 'bold',
  7542. 4 => 'underscore',
  7543. );
  7544. public function __construct(array $styles = array())
  7545. {
  7546. parent::__construct(true, $styles);
  7547. }
  7548. public function format($message)
  7549. {
  7550. $formatted = parent::format($message);
  7551. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7552. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7553. }
  7554. private function formatHtml($matches)
  7555. {
  7556. $out = '<span style="';
  7557. foreach (explode(';', $matches[1]) as $code) {
  7558. if (isset(self::$availableForegroundColors[$code])) {
  7559. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7560. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7561. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7562. } elseif (isset(self::$availableOptions[$code])) {
  7563. switch (self::$availableOptions[$code]) {
  7564. case 'bold':
  7565. $out .= 'font-weight:bold;';
  7566. break;
  7567. case 'underscore':
  7568. $out .= 'text-decoration:underline;';
  7569. break;
  7570. }
  7571. }
  7572. }
  7573. return $out.'">'.$matches[2].'</span>';
  7574. }
  7575. }
  7576. <?php
  7577. namespace Composer\DependencyResolver;
  7578. class Decisions implements \Iterator, \Countable
  7579. {
  7580. const DECISION_LITERAL = 0;
  7581. const DECISION_REASON = 1;
  7582. protected $pool;
  7583. protected $decisionMap;
  7584. protected $decisionQueue = array();
  7585. public function __construct($pool)
  7586. {
  7587. $this->pool = $pool;
  7588. $this->decisionMap = array();
  7589. }
  7590. public function decide($literal, $level, $why)
  7591. {
  7592. $this->addDecision($literal, $level);
  7593. $this->decisionQueue[] = array(
  7594. self::DECISION_LITERAL => $literal,
  7595. self::DECISION_REASON => $why,
  7596. );
  7597. }
  7598. public function satisfy($literal)
  7599. {
  7600. $packageId = abs($literal);
  7601. return (
  7602. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7603. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7604. );
  7605. }
  7606. public function conflict($literal)
  7607. {
  7608. $packageId = abs($literal);
  7609. return (
  7610. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7611. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7612. );
  7613. }
  7614. public function decided($literalOrPackageId)
  7615. {
  7616. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7617. }
  7618. public function undecided($literalOrPackageId)
  7619. {
  7620. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7621. }
  7622. public function decidedInstall($literalOrPackageId)
  7623. {
  7624. $packageId = abs($literalOrPackageId);
  7625. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7626. }
  7627. public function decisionLevel($literalOrPackageId)
  7628. {
  7629. $packageId = abs($literalOrPackageId);
  7630. if (isset($this->decisionMap[$packageId])) {
  7631. return abs($this->decisionMap[$packageId]);
  7632. }
  7633. return 0;
  7634. }
  7635. public function decisionRule($literalOrPackageId)
  7636. {
  7637. $packageId = abs($literalOrPackageId);
  7638. foreach ($this->decisionQueue as $i => $decision) {
  7639. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7640. return $decision[self::DECISION_REASON];
  7641. }
  7642. }
  7643. return null;
  7644. }
  7645. public function atOffset($queueOffset)
  7646. {
  7647. return $this->decisionQueue[$queueOffset];
  7648. }
  7649. public function validOffset($queueOffset)
  7650. {
  7651. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7652. }
  7653. public function lastReason()
  7654. {
  7655. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7656. }
  7657. public function lastLiteral()
  7658. {
  7659. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7660. }
  7661. public function reset()
  7662. {
  7663. while ($decision = array_pop($this->decisionQueue)) {
  7664. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7665. }
  7666. }
  7667. public function resetToOffset($offset)
  7668. {
  7669. while (count($this->decisionQueue) > $offset + 1) {
  7670. $decision = array_pop($this->decisionQueue);
  7671. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7672. }
  7673. }
  7674. public function revertLast()
  7675. {
  7676. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7677. array_pop($this->decisionQueue);
  7678. }
  7679. public function count()
  7680. {
  7681. return count($this->decisionQueue);
  7682. }
  7683. public function rewind()
  7684. {
  7685. end($this->decisionQueue);
  7686. }
  7687. public function current()
  7688. {
  7689. return current($this->decisionQueue);
  7690. }
  7691. public function key()
  7692. {
  7693. return key($this->decisionQueue);
  7694. }
  7695. public function next()
  7696. {
  7697. return prev($this->decisionQueue);
  7698. }
  7699. public function valid()
  7700. {
  7701. return false !== current($this->decisionQueue);
  7702. }
  7703. public function isEmpty()
  7704. {
  7705. return count($this->decisionQueue) === 0;
  7706. }
  7707. protected function addDecision($literal, $level)
  7708. {
  7709. $packageId = abs($literal);
  7710. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7711. if ($previousDecision != 0) {
  7712. $literalString = $this->pool->literalToString($literal);
  7713. $package = $this->pool->literalToPackage($literal);
  7714. throw new SolverBugException(
  7715. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7716. );
  7717. }
  7718. if ($literal > 0) {
  7719. $this->decisionMap[$packageId] = $level;
  7720. } else {
  7721. $this->decisionMap[$packageId] = -$level;
  7722. }
  7723. }
  7724. public function __toString()
  7725. {
  7726. $decisionMap = $this->decisionMap;
  7727. ksort($decisionMap);
  7728. $str = '[';
  7729. foreach ($decisionMap as $packageId => $level) {
  7730. $str .= $packageId.':'.$level.',';
  7731. }
  7732. $str .= ']';
  7733. return $str;
  7734. }
  7735. }
  7736. <?php
  7737. namespace Composer\DependencyResolver;
  7738. use Composer\Package\PackageInterface;
  7739. use Composer\Package\AliasPackage;
  7740. use Composer\Package\BasePackage;
  7741. use Composer\Semver\Constraint\Constraint;
  7742. class DefaultPolicy implements PolicyInterface
  7743. {
  7744. private $preferStable;
  7745. private $preferLowest;
  7746. public function __construct($preferStable = false, $preferLowest = false)
  7747. {
  7748. $this->preferStable = $preferStable;
  7749. $this->preferLowest = $preferLowest;
  7750. }
  7751. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7752. {
  7753. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7754. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7755. }
  7756. $constraint = new Constraint($operator, $b->getVersion());
  7757. $version = new Constraint('==', $a->getVersion());
  7758. return $constraint->matchSpecific($version, true);
  7759. }
  7760. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7761. {
  7762. $packages = array();
  7763. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7764. if ($candidate !== $package) {
  7765. $packages[] = $candidate;
  7766. }
  7767. }
  7768. return $packages;
  7769. }
  7770. public function getPriority(Pool $pool, PackageInterface $package)
  7771. {
  7772. return $pool->getPriority($package->getRepository());
  7773. }
  7774. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7775. {
  7776. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7777. foreach ($packages as &$literals) {
  7778. $policy = $this;
  7779. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7780. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7781. });
  7782. }
  7783. foreach ($packages as &$literals) {
  7784. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7785. $literals = $this->pruneToBestVersion($pool, $literals);
  7786. $literals = $this->pruneRemoteAliases($pool, $literals);
  7787. }
  7788. $selected = call_user_func_array('array_merge', $packages);
  7789. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7790. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7791. });
  7792. return $selected;
  7793. }
  7794. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7795. {
  7796. $packages = array();
  7797. foreach ($literals as $literal) {
  7798. $packageName = $pool->literalToPackage($literal)->getName();
  7799. if (!isset($packages[$packageName])) {
  7800. $packages[$packageName] = array();
  7801. }
  7802. if (isset($installedMap[abs($literal)])) {
  7803. array_unshift($packages[$packageName], $literal);
  7804. } else {
  7805. $packages[$packageName][] = $literal;
  7806. }
  7807. }
  7808. return $packages;
  7809. }
  7810. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7811. {
  7812. if ($a->getRepository() === $b->getRepository()) {
  7813. if ($a->getName() === $b->getName()) {
  7814. $aAliased = $a instanceof AliasPackage;
  7815. $bAliased = $b instanceof AliasPackage;
  7816. if ($aAliased && !$bAliased) {
  7817. return -1;
  7818. }
  7819. if (!$aAliased && $bAliased) {
  7820. return 1;
  7821. }
  7822. }
  7823. if (!$ignoreReplace) {
  7824. if ($this->replaces($a, $b)) {
  7825. return 1;
  7826. }
  7827. if ($this->replaces($b, $a)) {
  7828. return -1;
  7829. }
  7830. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7831. $requiredVendor = substr($requiredPackage, 0, $pos);
  7832. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7833. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7834. if ($bIsSameVendor !== $aIsSameVendor) {
  7835. return $aIsSameVendor ? -1 : 1;
  7836. }
  7837. }
  7838. }
  7839. if ($a->id === $b->id) {
  7840. return 0;
  7841. }
  7842. return ($a->id < $b->id) ? -1 : 1;
  7843. }
  7844. if (isset($installedMap[$a->id])) {
  7845. return -1;
  7846. }
  7847. if (isset($installedMap[$b->id])) {
  7848. return 1;
  7849. }
  7850. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7851. }
  7852. protected function replaces(PackageInterface $source, PackageInterface $target)
  7853. {
  7854. foreach ($source->getReplaces() as $link) {
  7855. if ($link->getTarget() === $target->getName()
  7856. ) {
  7857. return true;
  7858. }
  7859. }
  7860. return false;
  7861. }
  7862. protected function pruneToBestVersion(Pool $pool, $literals)
  7863. {
  7864. $operator = $this->preferLowest ? '<' : '>';
  7865. $bestLiterals = array($literals[0]);
  7866. $bestPackage = $pool->literalToPackage($literals[0]);
  7867. foreach ($literals as $i => $literal) {
  7868. if (0 === $i) {
  7869. continue;
  7870. }
  7871. $package = $pool->literalToPackage($literal);
  7872. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7873. $bestPackage = $package;
  7874. $bestLiterals = array($literal);
  7875. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7876. $bestLiterals[] = $literal;
  7877. }
  7878. }
  7879. return $bestLiterals;
  7880. }
  7881. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7882. {
  7883. $selected = array();
  7884. $priority = null;
  7885. foreach ($literals as $literal) {
  7886. $package = $pool->literalToPackage($literal);
  7887. if (isset($installedMap[$package->id])) {
  7888. $selected[] = $literal;
  7889. continue;
  7890. }
  7891. if (null === $priority) {
  7892. $priority = $this->getPriority($pool, $package);
  7893. }
  7894. if ($this->getPriority($pool, $package) != $priority) {
  7895. break;
  7896. }
  7897. $selected[] = $literal;
  7898. }
  7899. return $selected;
  7900. }
  7901. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7902. {
  7903. $hasLocalAlias = false;
  7904. foreach ($literals as $literal) {
  7905. $package = $pool->literalToPackage($literal);
  7906. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7907. $hasLocalAlias = true;
  7908. break;
  7909. }
  7910. }
  7911. if (!$hasLocalAlias) {
  7912. return $literals;
  7913. }
  7914. $selected = array();
  7915. foreach ($literals as $literal) {
  7916. $package = $pool->literalToPackage($literal);
  7917. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7918. $selected[] = $literal;
  7919. }
  7920. }
  7921. return $selected;
  7922. }
  7923. }
  7924. <?php
  7925. namespace Composer\DependencyResolver;
  7926. use Composer\Package\PackageInterface;
  7927. use Composer\Package\Link;
  7928. class GenericRule extends Rule
  7929. {
  7930. protected $literals;
  7931. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7932. {
  7933. parent::__construct($reason, $reasonData, $job);
  7934. sort($literals);
  7935. $this->literals = $literals;
  7936. }
  7937. public function getLiterals()
  7938. {
  7939. return $this->literals;
  7940. }
  7941. public function getHash()
  7942. {
  7943. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7944. return $data['hash'];
  7945. }
  7946. public function equals(Rule $rule)
  7947. {
  7948. return $this->literals === $rule->getLiterals();
  7949. }
  7950. public function isAssertion()
  7951. {
  7952. return 1 === count($this->literals);
  7953. }
  7954. public function __toString()
  7955. {
  7956. $result = $this->isDisabled() ? 'disabled(' : '(';
  7957. foreach ($this->literals as $i => $literal) {
  7958. if ($i != 0) {
  7959. $result .= '|';
  7960. }
  7961. $result .= $literal;
  7962. }
  7963. $result .= ')';
  7964. return $result;
  7965. }
  7966. }
  7967. <?php
  7968. namespace Composer\DependencyResolver\Operation;
  7969. use Composer\Package\PackageInterface;
  7970. class InstallOperation extends SolverOperation
  7971. {
  7972. protected $package;
  7973. public function __construct(PackageInterface $package, $reason = null)
  7974. {
  7975. parent::__construct($reason);
  7976. $this->package = $package;
  7977. }
  7978. public function getPackage()
  7979. {
  7980. return $this->package;
  7981. }
  7982. public function getJobType()
  7983. {
  7984. return 'install';
  7985. }
  7986. public function __toString()
  7987. {
  7988. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7989. }
  7990. }
  7991. <?php
  7992. namespace Composer\DependencyResolver\Operation;
  7993. use Composer\Package\AliasPackage;
  7994. use Composer\Package\PackageInterface;
  7995. class MarkAliasInstalledOperation extends SolverOperation
  7996. {
  7997. protected $package;
  7998. public function __construct(AliasPackage $package, $reason = null)
  7999. {
  8000. parent::__construct($reason);
  8001. $this->package = $package;
  8002. }
  8003. public function getPackage()
  8004. {
  8005. return $this->package;
  8006. }
  8007. public function getJobType()
  8008. {
  8009. return 'markAliasInstalled';
  8010. }
  8011. public function __toString()
  8012. {
  8013. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8014. }
  8015. }
  8016. <?php
  8017. namespace Composer\DependencyResolver\Operation;
  8018. use Composer\Package\AliasPackage;
  8019. use Composer\Package\PackageInterface;
  8020. class MarkAliasUninstalledOperation extends SolverOperation
  8021. {
  8022. protected $package;
  8023. public function __construct(AliasPackage $package, $reason = null)
  8024. {
  8025. parent::__construct($reason);
  8026. $this->package = $package;
  8027. }
  8028. public function getPackage()
  8029. {
  8030. return $this->package;
  8031. }
  8032. public function getJobType()
  8033. {
  8034. return 'markAliasUninstalled';
  8035. }
  8036. public function __toString()
  8037. {
  8038. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8039. }
  8040. }
  8041. <?php
  8042. namespace Composer\DependencyResolver\Operation;
  8043. interface OperationInterface
  8044. {
  8045. public function getJobType();
  8046. public function getReason();
  8047. public function __toString();
  8048. }
  8049. <?php
  8050. namespace Composer\DependencyResolver\Operation;
  8051. use Composer\Package\PackageInterface;
  8052. abstract class SolverOperation implements OperationInterface
  8053. {
  8054. protected $reason;
  8055. public function __construct($reason = null)
  8056. {
  8057. $this->reason = $reason;
  8058. }
  8059. public function getReason()
  8060. {
  8061. return $this->reason;
  8062. }
  8063. protected function formatVersion(PackageInterface $package)
  8064. {
  8065. return $package->getFullPrettyVersion();
  8066. }
  8067. }
  8068. <?php
  8069. namespace Composer\DependencyResolver\Operation;
  8070. use Composer\Package\PackageInterface;
  8071. class UninstallOperation extends SolverOperation
  8072. {
  8073. protected $package;
  8074. public function __construct(PackageInterface $package, $reason = null)
  8075. {
  8076. parent::__construct($reason);
  8077. $this->package = $package;
  8078. }
  8079. public function getPackage()
  8080. {
  8081. return $this->package;
  8082. }
  8083. public function getJobType()
  8084. {
  8085. return 'uninstall';
  8086. }
  8087. public function __toString()
  8088. {
  8089. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8090. }
  8091. }
  8092. <?php
  8093. namespace Composer\DependencyResolver\Operation;
  8094. use Composer\Package\PackageInterface;
  8095. class UpdateOperation extends SolverOperation
  8096. {
  8097. protected $initialPackage;
  8098. protected $targetPackage;
  8099. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8100. {
  8101. parent::__construct($reason);
  8102. $this->initialPackage = $initial;
  8103. $this->targetPackage = $target;
  8104. }
  8105. public function getInitialPackage()
  8106. {
  8107. return $this->initialPackage;
  8108. }
  8109. public function getTargetPackage()
  8110. {
  8111. return $this->targetPackage;
  8112. }
  8113. public function getJobType()
  8114. {
  8115. return 'update';
  8116. }
  8117. public function __toString()
  8118. {
  8119. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8120. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8121. }
  8122. }
  8123. <?php
  8124. namespace Composer\DependencyResolver;
  8125. use Composer\Package\PackageInterface;
  8126. interface PolicyInterface
  8127. {
  8128. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8129. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8130. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8131. }
  8132. <?php
  8133. namespace Composer\DependencyResolver;
  8134. use Composer\Package\BasePackage;
  8135. use Composer\Package\AliasPackage;
  8136. use Composer\Package\Version\VersionParser;
  8137. use Composer\Semver\Constraint\ConstraintInterface;
  8138. use Composer\Semver\Constraint\Constraint;
  8139. use Composer\Semver\Constraint\EmptyConstraint;
  8140. use Composer\Repository\RepositoryInterface;
  8141. use Composer\Repository\CompositeRepository;
  8142. use Composer\Repository\ComposerRepository;
  8143. use Composer\Repository\InstalledRepositoryInterface;
  8144. use Composer\Repository\PlatformRepository;
  8145. use Composer\Package\PackageInterface;
  8146. class Pool implements \Countable
  8147. {
  8148. const MATCH_NAME = -1;
  8149. const MATCH_NONE = 0;
  8150. const MATCH = 1;
  8151. const MATCH_PROVIDE = 2;
  8152. const MATCH_REPLACE = 3;
  8153. const MATCH_FILTERED = 4;
  8154. protected $repositories = array();
  8155. protected $providerRepos = array();
  8156. protected $packages = array();
  8157. protected $packageByName = array();
  8158. protected $packageByExactName = array();
  8159. protected $acceptableStabilities;
  8160. protected $stabilityFlags;
  8161. protected $versionParser;
  8162. protected $providerCache = array();
  8163. protected $filterRequires;
  8164. protected $whitelist = null;
  8165. protected $id = 1;
  8166. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8167. {
  8168. $this->versionParser = new VersionParser;
  8169. $this->acceptableStabilities = array();
  8170. foreach (BasePackage::$stabilities as $stability => $value) {
  8171. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8172. $this->acceptableStabilities[$stability] = $value;
  8173. }
  8174. }
  8175. $this->stabilityFlags = $stabilityFlags;
  8176. $this->filterRequires = $filterRequires;
  8177. foreach ($filterRequires as $name => $constraint) {
  8178. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8179. unset($this->filterRequires[$name]);
  8180. }
  8181. }
  8182. }
  8183. public function setWhitelist($whitelist)
  8184. {
  8185. $this->whitelist = $whitelist;
  8186. $this->providerCache = array();
  8187. }
  8188. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8189. {
  8190. if ($repo instanceof CompositeRepository) {
  8191. $repos = $repo->getRepositories();
  8192. } else {
  8193. $repos = array($repo);
  8194. }
  8195. foreach ($repos as $repo) {
  8196. $this->repositories[] = $repo;
  8197. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8198. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8199. $this->providerRepos[] = $repo;
  8200. $repo->setRootAliases($rootAliases);
  8201. $repo->resetPackageIds();
  8202. } else {
  8203. foreach ($repo->getPackages() as $package) {
  8204. $names = $package->getNames();
  8205. $stability = $package->getStability();
  8206. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8207. $package->setId($this->id++);
  8208. $this->packages[] = $package;
  8209. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8210. foreach ($names as $provided) {
  8211. $this->packageByName[$provided][] = $package;
  8212. }
  8213. $name = $package->getName();
  8214. if (isset($rootAliases[$name][$package->getVersion()])) {
  8215. $alias = $rootAliases[$name][$package->getVersion()];
  8216. if ($package instanceof AliasPackage) {
  8217. $package = $package->getAliasOf();
  8218. }
  8219. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8220. $aliasPackage->setRootPackageAlias(true);
  8221. $aliasPackage->setId($this->id++);
  8222. $package->getRepository()->addPackage($aliasPackage);
  8223. $this->packages[] = $aliasPackage;
  8224. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8225. foreach ($aliasPackage->getNames() as $name) {
  8226. $this->packageByName[$name][] = $aliasPackage;
  8227. }
  8228. }
  8229. }
  8230. }
  8231. }
  8232. }
  8233. }
  8234. public function getPriority(RepositoryInterface $repo)
  8235. {
  8236. $priority = array_search($repo, $this->repositories, true);
  8237. if (false === $priority) {
  8238. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8239. }
  8240. return -$priority;
  8241. }
  8242. public function packageById($id)
  8243. {
  8244. return $this->packages[$id - 1];
  8245. }
  8246. public function count()
  8247. {
  8248. return count($this->packages);
  8249. }
  8250. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8251. {
  8252. if ($bypassFilters) {
  8253. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8254. }
  8255. $key = ((int) $mustMatchName).$constraint;
  8256. if (isset($this->providerCache[$name][$key])) {
  8257. return $this->providerCache[$name][$key];
  8258. }
  8259. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8260. }
  8261. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8262. {
  8263. $candidates = array();
  8264. foreach ($this->providerRepos as $repo) {
  8265. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8266. $candidates[] = $candidate;
  8267. if ($candidate->id < 1) {
  8268. $candidate->setId($this->id++);
  8269. $this->packages[$this->id - 2] = $candidate;
  8270. }
  8271. }
  8272. }
  8273. if ($mustMatchName) {
  8274. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8275. return $candidate->getName() == $name;
  8276. });
  8277. if (isset($this->packageByExactName[$name])) {
  8278. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8279. }
  8280. } elseif (isset($this->packageByName[$name])) {
  8281. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8282. }
  8283. $matches = $provideMatches = array();
  8284. $nameMatch = false;
  8285. foreach ($candidates as $candidate) {
  8286. $aliasOfCandidate = null;
  8287. if ($candidate instanceof AliasPackage) {
  8288. $aliasOfCandidate = $candidate->getAliasOf();
  8289. }
  8290. if ($this->whitelist !== null && !$bypassFilters && (
  8291. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8292. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8293. )) {
  8294. continue;
  8295. }
  8296. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8297. case self::MATCH_NONE:
  8298. break;
  8299. case self::MATCH_NAME:
  8300. $nameMatch = true;
  8301. break;
  8302. case self::MATCH:
  8303. $nameMatch = true;
  8304. $matches[] = $candidate;
  8305. break;
  8306. case self::MATCH_PROVIDE:
  8307. $provideMatches[] = $candidate;
  8308. break;
  8309. case self::MATCH_REPLACE:
  8310. $matches[] = $candidate;
  8311. break;
  8312. case self::MATCH_FILTERED:
  8313. break;
  8314. default:
  8315. throw new \UnexpectedValueException('Unexpected match type');
  8316. }
  8317. }
  8318. if ($nameMatch) {
  8319. return $matches;
  8320. }
  8321. return array_merge($matches, $provideMatches);
  8322. }
  8323. public function literalToPackage($literal)
  8324. {
  8325. $packageId = abs($literal);
  8326. return $this->packageById($packageId);
  8327. }
  8328. public function literalToPrettyString($literal, $installedMap)
  8329. {
  8330. $package = $this->literalToPackage($literal);
  8331. if (isset($installedMap[$package->id])) {
  8332. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8333. } else {
  8334. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8335. }
  8336. return $prefix.' '.$package->getPrettyString();
  8337. }
  8338. public function isPackageAcceptable($name, $stability)
  8339. {
  8340. foreach ((array) $name as $n) {
  8341. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8342. return true;
  8343. }
  8344. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8345. return true;
  8346. }
  8347. }
  8348. return false;
  8349. }
  8350. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8351. {
  8352. $candidateName = $candidate->getName();
  8353. $candidateVersion = $candidate->getVersion();
  8354. $isDev = $candidate->getStability() === 'dev';
  8355. $isAlias = $candidate instanceof AliasPackage;
  8356. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8357. $requireFilter = $this->filterRequires[$name];
  8358. } else {
  8359. $requireFilter = new EmptyConstraint;
  8360. }
  8361. if ($candidateName === $name) {
  8362. $pkgConstraint = new Constraint('==', $candidateVersion);
  8363. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8364. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8365. }
  8366. return self::MATCH_NAME;
  8367. }
  8368. $provides = $candidate->getProvides();
  8369. $replaces = $candidate->getReplaces();
  8370. if (isset($replaces[0]) || isset($provides[0])) {
  8371. foreach ($provides as $link) {
  8372. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8373. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8374. }
  8375. }
  8376. foreach ($replaces as $link) {
  8377. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8378. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8379. }
  8380. }
  8381. return self::MATCH_NONE;
  8382. }
  8383. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8384. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8385. }
  8386. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8387. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8388. }
  8389. return self::MATCH_NONE;
  8390. }
  8391. }
  8392. <?php
  8393. namespace Composer\DependencyResolver;
  8394. use Composer\Package\CompletePackageInterface;
  8395. class Problem
  8396. {
  8397. protected $reasonSeen;
  8398. protected $reasons = array();
  8399. protected $section = 0;
  8400. protected $pool;
  8401. public function __construct(Pool $pool)
  8402. {
  8403. $this->pool = $pool;
  8404. }
  8405. public function addRule(Rule $rule)
  8406. {
  8407. $this->addReason(spl_object_hash($rule), array(
  8408. 'rule' => $rule,
  8409. 'job' => $rule->getJob(),
  8410. ));
  8411. }
  8412. public function getReasons()
  8413. {
  8414. return $this->reasons;
  8415. }
  8416. public function getPrettyString(array $installedMap = array())
  8417. {
  8418. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8419. if (count($reasons) === 1) {
  8420. reset($reasons);
  8421. $reason = current($reasons);
  8422. $job = $reason['job'];
  8423. $packageName = $job['packageName'];
  8424. $constraint = $job['constraint'];
  8425. if (isset($constraint)) {
  8426. $packages = $this->pool->whatProvides($packageName, $constraint);
  8427. } else {
  8428. $packages = array();
  8429. }
  8430. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8431. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  8432. $version = phpversion();
  8433. $available = $this->pool->whatProvides($packageName);
  8434. if (count($available)) {
  8435. $firstAvailable = reset($available);
  8436. $version = $firstAvailable->getPrettyVersion();
  8437. $extra = $firstAvailable->getExtra();
  8438. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8439. $version .= '; ' . $firstAvailable->getDescription();
  8440. }
  8441. }
  8442. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  8443. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  8444. return $msg . 'your HHVM version does not satisfy that requirement.';
  8445. }
  8446. if ($packageName === 'hhvm') {
  8447. return $msg . 'you are running this with PHP and not HHVM.';
  8448. }
  8449. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8450. }
  8451. if (0 === stripos($packageName, 'ext-')) {
  8452. if (false !== strpos($packageName, ' ')) {
  8453. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  8454. }
  8455. $ext = substr($packageName, 4);
  8456. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8457. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8458. }
  8459. if (0 === stripos($packageName, 'lib-')) {
  8460. if (strtolower($packageName) === 'lib-icu') {
  8461. $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.';
  8462. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  8463. }
  8464. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8465. }
  8466. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  8467. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  8468. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8469. }
  8470. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  8471. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8472. }
  8473. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  8474. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8475. }
  8476. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  8477. }
  8478. }
  8479. $messages = array();
  8480. foreach ($reasons as $reason) {
  8481. $rule = $reason['rule'];
  8482. $job = $reason['job'];
  8483. if ($job) {
  8484. $messages[] = $this->jobToText($job);
  8485. } elseif ($rule) {
  8486. if ($rule instanceof Rule) {
  8487. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8488. }
  8489. }
  8490. }
  8491. return "\n - ".implode("\n - ", $messages);
  8492. }
  8493. protected function addReason($id, $reason)
  8494. {
  8495. if (!isset($this->reasonSeen[$id])) {
  8496. $this->reasonSeen[$id] = true;
  8497. $this->reasons[$this->section][] = $reason;
  8498. }
  8499. }
  8500. public function nextSection()
  8501. {
  8502. $this->section++;
  8503. }
  8504. protected function jobToText($job)
  8505. {
  8506. $packageName = $job['packageName'];
  8507. $constraint = $job['constraint'];
  8508. switch ($job['cmd']) {
  8509. case 'install':
  8510. $packages = $this->pool->whatProvides($packageName, $constraint);
  8511. if (!$packages) {
  8512. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  8513. }
  8514. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8515. case 'update':
  8516. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  8517. case 'remove':
  8518. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  8519. }
  8520. if (isset($constraint)) {
  8521. $packages = $this->pool->whatProvides($packageName, $constraint);
  8522. } else {
  8523. $packages = array();
  8524. }
  8525. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  8526. }
  8527. protected function getPackageList($packages)
  8528. {
  8529. $prepared = array();
  8530. foreach ($packages as $package) {
  8531. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8532. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8533. }
  8534. foreach ($prepared as $name => $package) {
  8535. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8536. }
  8537. return implode(', ', $prepared);
  8538. }
  8539. protected function constraintToText($constraint)
  8540. {
  8541. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8542. }
  8543. }
  8544. <?php
  8545. namespace Composer\DependencyResolver;
  8546. use Composer\Semver\Constraint\ConstraintInterface;
  8547. class Request
  8548. {
  8549. protected $jobs;
  8550. public function __construct()
  8551. {
  8552. $this->jobs = array();
  8553. }
  8554. public function install($packageName, ConstraintInterface $constraint = null)
  8555. {
  8556. $this->addJob($packageName, 'install', $constraint);
  8557. }
  8558. public function update($packageName, ConstraintInterface $constraint = null)
  8559. {
  8560. $this->addJob($packageName, 'update', $constraint);
  8561. }
  8562. public function remove($packageName, ConstraintInterface $constraint = null)
  8563. {
  8564. $this->addJob($packageName, 'remove', $constraint);
  8565. }
  8566. public function fix($packageName, ConstraintInterface $constraint = null)
  8567. {
  8568. $this->addJob($packageName, 'install', $constraint, true);
  8569. }
  8570. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8571. {
  8572. $packageName = strtolower($packageName);
  8573. $this->jobs[] = array(
  8574. 'cmd' => $cmd,
  8575. 'packageName' => $packageName,
  8576. 'constraint' => $constraint,
  8577. 'fixed' => $fixed,
  8578. );
  8579. }
  8580. public function updateAll()
  8581. {
  8582. $this->jobs[] = array('cmd' => 'update-all');
  8583. }
  8584. public function getJobs()
  8585. {
  8586. return $this->jobs;
  8587. }
  8588. }
  8589. <?php
  8590. namespace Composer\DependencyResolver;
  8591. use Composer\Package\CompletePackage;
  8592. use Composer\Package\Link;
  8593. use Composer\Package\PackageInterface;
  8594. abstract class Rule
  8595. {
  8596. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8597. const RULE_JOB_INSTALL = 2;
  8598. const RULE_JOB_REMOVE = 3;
  8599. const RULE_PACKAGE_CONFLICT = 6;
  8600. const RULE_PACKAGE_REQUIRES = 7;
  8601. const RULE_PACKAGE_OBSOLETES = 8;
  8602. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8603. const RULE_PACKAGE_SAME_NAME = 10;
  8604. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8605. const RULE_LEARNED = 12;
  8606. const RULE_PACKAGE_ALIAS = 13;
  8607. const BITFIELD_TYPE = 0;
  8608. const BITFIELD_REASON = 8;
  8609. const BITFIELD_DISABLED = 16;
  8610. protected $bitfield;
  8611. protected $job;
  8612. protected $reasonData;
  8613. public function __construct($reason, $reasonData, $job = null)
  8614. {
  8615. $this->reasonData = $reasonData;
  8616. if ($job) {
  8617. $this->job = $job;
  8618. }
  8619. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8620. ($reason << self::BITFIELD_REASON) |
  8621. (255 << self::BITFIELD_TYPE);
  8622. }
  8623. abstract public function getLiterals();
  8624. abstract public function getHash();
  8625. public function getJob()
  8626. {
  8627. return $this->job;
  8628. }
  8629. abstract public function equals(Rule $rule);
  8630. public function getReason()
  8631. {
  8632. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8633. }
  8634. public function getReasonData()
  8635. {
  8636. return $this->reasonData;
  8637. }
  8638. public function getRequiredPackage()
  8639. {
  8640. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8641. return $this->reasonData;
  8642. }
  8643. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8644. return $this->reasonData->getTarget();
  8645. }
  8646. }
  8647. public function setType($type)
  8648. {
  8649. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8650. }
  8651. public function getType()
  8652. {
  8653. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8654. }
  8655. public function disable()
  8656. {
  8657. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8658. }
  8659. public function enable()
  8660. {
  8661. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  8662. }
  8663. public function isDisabled()
  8664. {
  8665. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8666. }
  8667. public function isEnabled()
  8668. {
  8669. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8670. }
  8671. abstract public function isAssertion();
  8672. public function getPrettyString(Pool $pool, array $installedMap = array())
  8673. {
  8674. $literals = $this->getLiterals();
  8675. $ruleText = '';
  8676. foreach ($literals as $i => $literal) {
  8677. if ($i != 0) {
  8678. $ruleText .= '|';
  8679. }
  8680. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8681. }
  8682. switch ($this->getReason()) {
  8683. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8684. return $ruleText;
  8685. case self::RULE_JOB_INSTALL:
  8686. return "Install command rule ($ruleText)";
  8687. case self::RULE_JOB_REMOVE:
  8688. return "Remove command rule ($ruleText)";
  8689. case self::RULE_PACKAGE_CONFLICT:
  8690. $package1 = $pool->literalToPackage($literals[0]);
  8691. $package2 = $pool->literalToPackage($literals[1]);
  8692. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8693. case self::RULE_PACKAGE_REQUIRES:
  8694. $sourceLiteral = array_shift($literals);
  8695. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8696. $requires = array();
  8697. foreach ($literals as $literal) {
  8698. $requires[] = $pool->literalToPackage($literal);
  8699. }
  8700. $text = $this->reasonData->getPrettyString($sourcePackage);
  8701. if ($requires) {
  8702. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8703. } else {
  8704. $targetName = $this->reasonData->getTarget();
  8705. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8706. if (defined('HHVM_VERSION')) {
  8707. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8708. }
  8709. $packages = $pool->whatProvides($targetName);
  8710. $package = count($packages) ? current($packages) : phpversion();
  8711. if ($targetName === 'hhvm') {
  8712. if ($package instanceof CompletePackage) {
  8713. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8714. } else {
  8715. return $text . ' -> you are running this with PHP and not HHVM.';
  8716. }
  8717. }
  8718. if (!($package instanceof CompletePackage)) {
  8719. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8720. }
  8721. $extra = $package->getExtra();
  8722. if (!empty($extra['config.platform'])) {
  8723. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8724. } else {
  8725. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8726. }
  8727. return $text;
  8728. }
  8729. if (0 === strpos($targetName, 'ext-')) {
  8730. $ext = substr($targetName, 4);
  8731. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8732. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8733. }
  8734. if (0 === strpos($targetName, 'lib-')) {
  8735. $lib = substr($targetName, 4);
  8736. 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.';
  8737. }
  8738. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8739. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8740. }
  8741. return $text . ' -> no matching package found.';
  8742. }
  8743. return $text;
  8744. case self::RULE_PACKAGE_OBSOLETES:
  8745. return $ruleText;
  8746. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8747. return $ruleText;
  8748. case self::RULE_PACKAGE_SAME_NAME:
  8749. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8750. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8751. return $ruleText;
  8752. case self::RULE_LEARNED:
  8753. return 'Conclusion: '.$ruleText;
  8754. case self::RULE_PACKAGE_ALIAS:
  8755. return $ruleText;
  8756. default:
  8757. return '('.$ruleText.')';
  8758. }
  8759. }
  8760. protected function formatPackagesUnique($pool, array $packages)
  8761. {
  8762. $prepared = array();
  8763. foreach ($packages as $package) {
  8764. if (!is_object($package)) {
  8765. $package = $pool->literalToPackage($package);
  8766. }
  8767. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8768. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8769. }
  8770. foreach ($prepared as $name => $package) {
  8771. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8772. }
  8773. return implode(', ', $prepared);
  8774. }
  8775. }
  8776. <?php
  8777. namespace Composer\DependencyResolver;
  8778. use Composer\Package\PackageInterface;
  8779. use Composer\Package\Link;
  8780. class Rule2Literals extends Rule
  8781. {
  8782. protected $literal1;
  8783. protected $literal2;
  8784. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8785. {
  8786. parent::__construct($reason, $reasonData, $job);
  8787. if ($literal1 < $literal2) {
  8788. $this->literal1 = $literal1;
  8789. $this->literal2 = $literal2;
  8790. } else {
  8791. $this->literal1 = $literal2;
  8792. $this->literal2 = $literal1;
  8793. }
  8794. }
  8795. public function getLiterals()
  8796. {
  8797. return array($this->literal1, $this->literal2);
  8798. }
  8799. public function getHash()
  8800. {
  8801. return $this->literal1.','.$this->literal2;
  8802. }
  8803. public function equals(Rule $rule)
  8804. {
  8805. if ($rule instanceof self) {
  8806. if ($this->literal1 !== $rule->literal1) {
  8807. return false;
  8808. }
  8809. if ($this->literal2 !== $rule->literal2) {
  8810. return false;
  8811. }
  8812. return true;
  8813. }
  8814. $literals = $rule->getLiterals();
  8815. if (2 != count($literals)) {
  8816. return false;
  8817. }
  8818. if ($this->literal1 !== $literals[0]) {
  8819. return false;
  8820. }
  8821. if ($this->literal2 !== $literals[1]) {
  8822. return false;
  8823. }
  8824. return true;
  8825. }
  8826. public function isAssertion()
  8827. {
  8828. return false;
  8829. }
  8830. public function __toString()
  8831. {
  8832. $result = $this->isDisabled() ? 'disabled(' : '(';
  8833. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8834. return $result;
  8835. }
  8836. }
  8837. <?php
  8838. namespace Composer\DependencyResolver;
  8839. class RuleSet implements \IteratorAggregate, \Countable
  8840. {
  8841. const TYPE_PACKAGE = 0;
  8842. const TYPE_JOB = 1;
  8843. const TYPE_LEARNED = 4;
  8844. public $ruleById;
  8845. protected static $types = array(
  8846. 255 => 'UNKNOWN',
  8847. self::TYPE_PACKAGE => 'PACKAGE',
  8848. self::TYPE_JOB => 'JOB',
  8849. self::TYPE_LEARNED => 'LEARNED',
  8850. );
  8851. protected $rules;
  8852. protected $nextRuleId;
  8853. protected $rulesByHash;
  8854. public function __construct()
  8855. {
  8856. $this->nextRuleId = 0;
  8857. foreach ($this->getTypes() as $type) {
  8858. $this->rules[$type] = array();
  8859. }
  8860. $this->rulesByHash = array();
  8861. }
  8862. public function add(Rule $rule, $type)
  8863. {
  8864. if (!isset(self::$types[$type])) {
  8865. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8866. }
  8867. $hash = $rule->getHash();
  8868. if (isset($this->rulesByHash[$hash])) {
  8869. $potentialDuplicates = $this->rulesByHash[$hash];
  8870. if (is_array($potentialDuplicates)) {
  8871. foreach ($potentialDuplicates as $potentialDuplicate) {
  8872. if ($rule->equals($potentialDuplicate)) {
  8873. return;
  8874. }
  8875. }
  8876. } else {
  8877. if ($rule->equals($potentialDuplicates)) {
  8878. return;
  8879. }
  8880. }
  8881. }
  8882. if (!isset($this->rules[$type])) {
  8883. $this->rules[$type] = array();
  8884. }
  8885. $this->rules[$type][] = $rule;
  8886. $this->ruleById[$this->nextRuleId] = $rule;
  8887. $rule->setType($type);
  8888. $this->nextRuleId++;
  8889. if (!isset($this->rulesByHash[$hash])) {
  8890. $this->rulesByHash[$hash] = $rule;
  8891. } elseif (is_array($this->rulesByHash[$hash])) {
  8892. $this->rulesByHash[$hash][] = $rule;
  8893. } else {
  8894. $originalRule = $this->rulesByHash[$hash];
  8895. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8896. }
  8897. }
  8898. public function count()
  8899. {
  8900. return $this->nextRuleId;
  8901. }
  8902. public function ruleById($id)
  8903. {
  8904. return $this->ruleById[$id];
  8905. }
  8906. public function getRules()
  8907. {
  8908. return $this->rules;
  8909. }
  8910. public function getIterator()
  8911. {
  8912. return new RuleSetIterator($this->getRules());
  8913. }
  8914. public function getIteratorFor($types)
  8915. {
  8916. if (!is_array($types)) {
  8917. $types = array($types);
  8918. }
  8919. $allRules = $this->getRules();
  8920. $rules = array();
  8921. foreach ($types as $type) {
  8922. $rules[$type] = $allRules[$type];
  8923. }
  8924. return new RuleSetIterator($rules);
  8925. }
  8926. public function getIteratorWithout($types)
  8927. {
  8928. if (!is_array($types)) {
  8929. $types = array($types);
  8930. }
  8931. $rules = $this->getRules();
  8932. foreach ($types as $type) {
  8933. unset($rules[$type]);
  8934. }
  8935. return new RuleSetIterator($rules);
  8936. }
  8937. public function getTypes()
  8938. {
  8939. $types = self::$types;
  8940. unset($types[255]);
  8941. return array_keys($types);
  8942. }
  8943. public function getPrettyString(Pool $pool = null)
  8944. {
  8945. $string = "\n";
  8946. foreach ($this->rules as $type => $rules) {
  8947. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8948. foreach ($rules as $rule) {
  8949. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8950. }
  8951. $string .= "\n\n";
  8952. }
  8953. return $string;
  8954. }
  8955. public function __toString()
  8956. {
  8957. return $this->getPrettyString(null);
  8958. }
  8959. }
  8960. <?php
  8961. namespace Composer\DependencyResolver;
  8962. use Composer\Package\PackageInterface;
  8963. use Composer\Package\AliasPackage;
  8964. use Composer\Repository\PlatformRepository;
  8965. class RuleSetGenerator
  8966. {
  8967. protected $policy;
  8968. protected $pool;
  8969. protected $rules;
  8970. protected $jobs;
  8971. protected $installedMap;
  8972. protected $whitelistedMap;
  8973. protected $addedMap;
  8974. protected $conflictAddedMap;
  8975. protected $addedPackages;
  8976. protected $addedPackagesByNames;
  8977. public function __construct(PolicyInterface $policy, Pool $pool)
  8978. {
  8979. $this->policy = $policy;
  8980. $this->pool = $pool;
  8981. }
  8982. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8983. {
  8984. $literals = array(-$package->id);
  8985. foreach ($providers as $provider) {
  8986. if ($provider === $package) {
  8987. return null;
  8988. }
  8989. $literals[] = $provider->id;
  8990. }
  8991. return new GenericRule($literals, $reason, $reasonData);
  8992. }
  8993. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8994. {
  8995. $literals = array();
  8996. foreach ($packages as $package) {
  8997. $literals[] = $package->id;
  8998. }
  8999. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9000. }
  9001. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9002. {
  9003. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9004. }
  9005. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9006. {
  9007. if ($issuer === $provider) {
  9008. return null;
  9009. }
  9010. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9011. }
  9012. private function addRule($type, Rule $newRule = null)
  9013. {
  9014. if (!$newRule) {
  9015. return;
  9016. }
  9017. $this->rules->add($newRule, $type);
  9018. }
  9019. protected function whitelistFromPackage(PackageInterface $package)
  9020. {
  9021. $workQueue = new \SplQueue;
  9022. $workQueue->enqueue($package);
  9023. while (!$workQueue->isEmpty()) {
  9024. $package = $workQueue->dequeue();
  9025. if (isset($this->whitelistedMap[$package->id])) {
  9026. continue;
  9027. }
  9028. $this->whitelistedMap[$package->id] = true;
  9029. foreach ($package->getRequires() as $link) {
  9030. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9031. foreach ($possibleRequires as $require) {
  9032. $workQueue->enqueue($require);
  9033. }
  9034. }
  9035. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9036. foreach ($obsoleteProviders as $provider) {
  9037. if ($provider === $package) {
  9038. continue;
  9039. }
  9040. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9041. $workQueue->enqueue($provider);
  9042. }
  9043. }
  9044. }
  9045. }
  9046. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9047. {
  9048. $workQueue = new \SplQueue;
  9049. $workQueue->enqueue($package);
  9050. while (!$workQueue->isEmpty()) {
  9051. $package = $workQueue->dequeue();
  9052. if (isset($this->addedMap[$package->id])) {
  9053. continue;
  9054. }
  9055. $this->addedMap[$package->id] = true;
  9056. $this->addedPackages[] = $package;
  9057. foreach ($package->getNames() as $name) {
  9058. $this->addedPackagesByNames[$name][] = $package;
  9059. }
  9060. foreach ($package->getRequires() as $link) {
  9061. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9062. continue;
  9063. }
  9064. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9065. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9066. foreach ($possibleRequires as $require) {
  9067. $workQueue->enqueue($require);
  9068. }
  9069. }
  9070. $packageName = $package->getName();
  9071. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9072. foreach ($obsoleteProviders as $provider) {
  9073. if ($provider === $package) {
  9074. continue;
  9075. }
  9076. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9077. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9078. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9079. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9080. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9081. }
  9082. }
  9083. }
  9084. }
  9085. protected function addConflictRules($ignorePlatformReqs = false)
  9086. {
  9087. foreach ($this->addedPackages as $package) {
  9088. foreach ($package->getConflicts() as $link) {
  9089. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9090. continue;
  9091. }
  9092. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9093. continue;
  9094. }
  9095. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9096. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9097. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9098. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9099. }
  9100. }
  9101. }
  9102. $isInstalled = isset($this->installedMap[$package->id]);
  9103. foreach ($package->getReplaces() as $link) {
  9104. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9105. continue;
  9106. }
  9107. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9108. if ($provider === $package) {
  9109. continue;
  9110. }
  9111. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9112. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9113. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9114. }
  9115. }
  9116. }
  9117. }
  9118. }
  9119. protected function obsoleteImpossibleForAlias($package, $provider)
  9120. {
  9121. $packageIsAlias = $package instanceof AliasPackage;
  9122. $providerIsAlias = $provider instanceof AliasPackage;
  9123. $impossible = (
  9124. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9125. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9126. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9127. );
  9128. return $impossible;
  9129. }
  9130. protected function whitelistFromJobs()
  9131. {
  9132. foreach ($this->jobs as $job) {
  9133. switch ($job['cmd']) {
  9134. case 'install':
  9135. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9136. foreach ($packages as $package) {
  9137. $this->whitelistFromPackage($package);
  9138. }
  9139. break;
  9140. }
  9141. }
  9142. }
  9143. protected function addRulesForJobs($ignorePlatformReqs)
  9144. {
  9145. foreach ($this->jobs as $job) {
  9146. switch ($job['cmd']) {
  9147. case 'install':
  9148. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9149. break;
  9150. }
  9151. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9152. if ($packages) {
  9153. foreach ($packages as $package) {
  9154. if (!isset($this->installedMap[$package->id])) {
  9155. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9156. }
  9157. }
  9158. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9159. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9160. }
  9161. break;
  9162. case 'remove':
  9163. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9164. foreach ($packages as $package) {
  9165. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9166. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9167. }
  9168. break;
  9169. }
  9170. }
  9171. }
  9172. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9173. {
  9174. $this->jobs = $jobs;
  9175. $this->rules = new RuleSet;
  9176. $this->installedMap = $installedMap;
  9177. $this->whitelistedMap = array();
  9178. foreach ($this->installedMap as $package) {
  9179. $this->whitelistFromPackage($package);
  9180. }
  9181. $this->whitelistFromJobs();
  9182. $this->pool->setWhitelist($this->whitelistedMap);
  9183. $this->addedMap = array();
  9184. $this->conflictAddedMap = array();
  9185. $this->addedPackages = array();
  9186. $this->addedPackagesByNames = array();
  9187. foreach ($this->installedMap as $package) {
  9188. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9189. }
  9190. $this->addRulesForJobs($ignorePlatformReqs);
  9191. $this->addConflictRules($ignorePlatformReqs);
  9192. $this->addedPackages = $this->addedPackagesByNames = null;
  9193. return $this->rules;
  9194. }
  9195. }
  9196. <?php
  9197. namespace Composer\DependencyResolver;
  9198. class RuleSetIterator implements \Iterator
  9199. {
  9200. protected $rules;
  9201. protected $types;
  9202. protected $currentOffset;
  9203. protected $currentType;
  9204. protected $currentTypeOffset;
  9205. public function __construct(array $rules)
  9206. {
  9207. $this->rules = $rules;
  9208. $this->types = array_keys($rules);
  9209. sort($this->types);
  9210. $this->rewind();
  9211. }
  9212. public function current()
  9213. {
  9214. return $this->rules[$this->currentType][$this->currentOffset];
  9215. }
  9216. public function key()
  9217. {
  9218. return $this->currentType;
  9219. }
  9220. public function next()
  9221. {
  9222. $this->currentOffset++;
  9223. if (!isset($this->rules[$this->currentType])) {
  9224. return;
  9225. }
  9226. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9227. $this->currentOffset = 0;
  9228. do {
  9229. $this->currentTypeOffset++;
  9230. if (!isset($this->types[$this->currentTypeOffset])) {
  9231. $this->currentType = -1;
  9232. break;
  9233. }
  9234. $this->currentType = $this->types[$this->currentTypeOffset];
  9235. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9236. }
  9237. }
  9238. public function rewind()
  9239. {
  9240. $this->currentOffset = 0;
  9241. $this->currentTypeOffset = -1;
  9242. $this->currentType = -1;
  9243. do {
  9244. $this->currentTypeOffset++;
  9245. if (!isset($this->types[$this->currentTypeOffset])) {
  9246. $this->currentType = -1;
  9247. break;
  9248. }
  9249. $this->currentType = $this->types[$this->currentTypeOffset];
  9250. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9251. }
  9252. public function valid()
  9253. {
  9254. return isset($this->rules[$this->currentType])
  9255. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9256. }
  9257. }
  9258. <?php
  9259. namespace Composer\DependencyResolver;
  9260. class RuleWatchChain extends \SplDoublyLinkedList
  9261. {
  9262. protected $offset = 0;
  9263. public function seek($offset)
  9264. {
  9265. $this->rewind();
  9266. for ($i = 0; $i < $offset; $i++, $this->next());
  9267. }
  9268. public function remove()
  9269. {
  9270. $offset = $this->key();
  9271. $this->offsetUnset($offset);
  9272. $this->seek($offset);
  9273. }
  9274. }
  9275. <?php
  9276. namespace Composer\DependencyResolver;
  9277. class RuleWatchGraph
  9278. {
  9279. protected $watchChains = array();
  9280. public function insert(RuleWatchNode $node)
  9281. {
  9282. if ($node->getRule()->isAssertion()) {
  9283. return;
  9284. }
  9285. foreach (array($node->watch1, $node->watch2) as $literal) {
  9286. if (!isset($this->watchChains[$literal])) {
  9287. $this->watchChains[$literal] = new RuleWatchChain;
  9288. }
  9289. $this->watchChains[$literal]->unshift($node);
  9290. }
  9291. }
  9292. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9293. {
  9294. $literal = -$decidedLiteral;
  9295. if (!isset($this->watchChains[$literal])) {
  9296. return null;
  9297. }
  9298. $chain = $this->watchChains[$literal];
  9299. $chain->rewind();
  9300. while ($chain->valid()) {
  9301. $node = $chain->current();
  9302. $otherWatch = $node->getOtherWatch($literal);
  9303. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9304. $ruleLiterals = $node->getRule()->getLiterals();
  9305. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9306. return $literal !== $ruleLiteral &&
  9307. $otherWatch !== $ruleLiteral &&
  9308. !$decisions->conflict($ruleLiteral);
  9309. });
  9310. if ($alternativeLiterals) {
  9311. reset($alternativeLiterals);
  9312. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9313. continue;
  9314. }
  9315. if ($decisions->conflict($otherWatch)) {
  9316. return $node->getRule();
  9317. }
  9318. $decisions->decide($otherWatch, $level, $node->getRule());
  9319. }
  9320. $chain->next();
  9321. }
  9322. return null;
  9323. }
  9324. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9325. {
  9326. if (!isset($this->watchChains[$toLiteral])) {
  9327. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9328. }
  9329. $node->moveWatch($fromLiteral, $toLiteral);
  9330. $this->watchChains[$fromLiteral]->remove();
  9331. $this->watchChains[$toLiteral]->unshift($node);
  9332. }
  9333. }
  9334. <?php
  9335. namespace Composer\DependencyResolver;
  9336. class RuleWatchNode
  9337. {
  9338. public $watch1;
  9339. public $watch2;
  9340. protected $rule;
  9341. public function __construct($rule)
  9342. {
  9343. $this->rule = $rule;
  9344. $literals = $rule->getLiterals();
  9345. $literalCount = count($literals);
  9346. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9347. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9348. }
  9349. public function watch2OnHighest(Decisions $decisions)
  9350. {
  9351. $literals = $this->rule->getLiterals();
  9352. if (count($literals) < 3) {
  9353. return;
  9354. }
  9355. $watchLevel = 0;
  9356. foreach ($literals as $literal) {
  9357. $level = $decisions->decisionLevel($literal);
  9358. if ($level > $watchLevel) {
  9359. $this->watch2 = $literal;
  9360. $watchLevel = $level;
  9361. }
  9362. }
  9363. }
  9364. public function getRule()
  9365. {
  9366. return $this->rule;
  9367. }
  9368. public function getOtherWatch($literal)
  9369. {
  9370. if ($this->watch1 == $literal) {
  9371. return $this->watch2;
  9372. }
  9373. return $this->watch1;
  9374. }
  9375. public function moveWatch($from, $to)
  9376. {
  9377. if ($this->watch1 == $from) {
  9378. $this->watch1 = $to;
  9379. } else {
  9380. $this->watch2 = $to;
  9381. }
  9382. }
  9383. }
  9384. <?php
  9385. namespace Composer\DependencyResolver;
  9386. use Composer\IO\IOInterface;
  9387. use Composer\Repository\RepositoryInterface;
  9388. use Composer\Repository\PlatformRepository;
  9389. class Solver
  9390. {
  9391. const BRANCH_LITERALS = 0;
  9392. const BRANCH_LEVEL = 1;
  9393. protected $policy;
  9394. protected $pool;
  9395. protected $installed;
  9396. protected $rules;
  9397. protected $ruleSetGenerator;
  9398. protected $jobs;
  9399. protected $updateMap = array();
  9400. protected $watchGraph;
  9401. protected $decisions;
  9402. protected $installedMap;
  9403. protected $propagateIndex;
  9404. protected $branches = array();
  9405. protected $problems = array();
  9406. protected $learnedPool = array();
  9407. protected $learnedWhy = array();
  9408. public $testFlagLearnedPositiveLiteral = false;
  9409. protected $io;
  9410. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9411. {
  9412. $this->io = $io;
  9413. $this->policy = $policy;
  9414. $this->pool = $pool;
  9415. $this->installed = $installed;
  9416. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9417. }
  9418. public function getRuleSetSize()
  9419. {
  9420. return count($this->rules);
  9421. }
  9422. private function makeAssertionRuleDecisions()
  9423. {
  9424. $decisionStart = count($this->decisions) - 1;
  9425. $rulesCount = count($this->rules);
  9426. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9427. $rule = $this->rules->ruleById[$ruleIndex];
  9428. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9429. continue;
  9430. }
  9431. $literals = $rule->getLiterals();
  9432. $literal = $literals[0];
  9433. if (!$this->decisions->decided($literal)) {
  9434. $this->decisions->decide($literal, 1, $rule);
  9435. continue;
  9436. }
  9437. if ($this->decisions->satisfy($literal)) {
  9438. continue;
  9439. }
  9440. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9441. $rule->disable();
  9442. continue;
  9443. }
  9444. $conflict = $this->decisions->decisionRule($literal);
  9445. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9446. $problem = new Problem($this->pool);
  9447. $problem->addRule($rule);
  9448. $problem->addRule($conflict);
  9449. $this->disableProblem($rule);
  9450. $this->problems[] = $problem;
  9451. continue;
  9452. }
  9453. $problem = new Problem($this->pool);
  9454. $problem->addRule($rule);
  9455. $problem->addRule($conflict);
  9456. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9457. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9458. continue;
  9459. }
  9460. $assertRuleLiterals = $assertRule->getLiterals();
  9461. $assertRuleLiteral = $assertRuleLiterals[0];
  9462. if (abs($literal) !== abs($assertRuleLiteral)) {
  9463. continue;
  9464. }
  9465. $problem->addRule($assertRule);
  9466. $this->disableProblem($assertRule);
  9467. }
  9468. $this->problems[] = $problem;
  9469. $this->decisions->resetToOffset($decisionStart);
  9470. $ruleIndex = -1;
  9471. }
  9472. }
  9473. protected function setupInstalledMap()
  9474. {
  9475. $this->installedMap = array();
  9476. foreach ($this->installed->getPackages() as $package) {
  9477. $this->installedMap[$package->id] = $package;
  9478. }
  9479. }
  9480. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9481. {
  9482. foreach ($this->jobs as $job) {
  9483. switch ($job['cmd']) {
  9484. case 'update':
  9485. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9486. foreach ($packages as $package) {
  9487. if (isset($this->installedMap[$package->id])) {
  9488. $this->updateMap[$package->id] = true;
  9489. }
  9490. }
  9491. break;
  9492. case 'update-all':
  9493. foreach ($this->installedMap as $package) {
  9494. $this->updateMap[$package->id] = true;
  9495. }
  9496. break;
  9497. case 'install':
  9498. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9499. break;
  9500. }
  9501. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9502. $problem = new Problem($this->pool);
  9503. $problem->addRule(new GenericRule(array(), null, null, $job));
  9504. $this->problems[] = $problem;
  9505. }
  9506. break;
  9507. }
  9508. }
  9509. }
  9510. public function solve(Request $request, $ignorePlatformReqs = false)
  9511. {
  9512. $this->jobs = $request->getJobs();
  9513. $this->setupInstalledMap();
  9514. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9515. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9516. $this->decisions = new Decisions($this->pool);
  9517. $this->watchGraph = new RuleWatchGraph;
  9518. foreach ($this->rules as $rule) {
  9519. $this->watchGraph->insert(new RuleWatchNode($rule));
  9520. }
  9521. $this->makeAssertionRuleDecisions();
  9522. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9523. $before = microtime(true);
  9524. $this->runSat(true);
  9525. $this->io->writeError('', true, IOInterface::DEBUG);
  9526. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9527. foreach ($this->installedMap as $packageId => $void) {
  9528. if ($this->decisions->undecided($packageId)) {
  9529. $this->decisions->decide(-$packageId, 1, null);
  9530. }
  9531. }
  9532. if ($this->problems) {
  9533. throw new SolverProblemsException($this->problems, $this->installedMap);
  9534. }
  9535. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9536. return $transaction->getOperations();
  9537. }
  9538. protected function propagate($level)
  9539. {
  9540. while ($this->decisions->validOffset($this->propagateIndex)) {
  9541. $decision = $this->decisions->atOffset($this->propagateIndex);
  9542. $conflict = $this->watchGraph->propagateLiteral(
  9543. $decision[Decisions::DECISION_LITERAL],
  9544. $level,
  9545. $this->decisions
  9546. );
  9547. $this->propagateIndex++;
  9548. if ($conflict) {
  9549. return $conflict;
  9550. }
  9551. }
  9552. return null;
  9553. }
  9554. private function revert($level)
  9555. {
  9556. while (!$this->decisions->isEmpty()) {
  9557. $literal = $this->decisions->lastLiteral();
  9558. if ($this->decisions->undecided($literal)) {
  9559. break;
  9560. }
  9561. $decisionLevel = $this->decisions->decisionLevel($literal);
  9562. if ($decisionLevel <= $level) {
  9563. break;
  9564. }
  9565. $this->decisions->revertLast();
  9566. $this->propagateIndex = count($this->decisions);
  9567. }
  9568. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9569. array_pop($this->branches);
  9570. }
  9571. }
  9572. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9573. {
  9574. $level++;
  9575. $this->decisions->decide($literal, $level, $rule);
  9576. while (true) {
  9577. $rule = $this->propagate($level);
  9578. if (!$rule) {
  9579. break;
  9580. }
  9581. if ($level == 1) {
  9582. return $this->analyzeUnsolvable($rule, $disableRules);
  9583. }
  9584. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9585. if ($newLevel <= 0 || $newLevel >= $level) {
  9586. throw new SolverBugException(
  9587. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9588. );
  9589. } elseif (!$newRule) {
  9590. throw new SolverBugException(
  9591. "No rule was learned from analyzing $rule at level $level."
  9592. );
  9593. }
  9594. $level = $newLevel;
  9595. $this->revert($level);
  9596. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9597. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9598. $ruleNode = new RuleWatchNode($newRule);
  9599. $ruleNode->watch2OnHighest($this->decisions);
  9600. $this->watchGraph->insert($ruleNode);
  9601. $this->decisions->decide($learnLiteral, $level, $newRule);
  9602. }
  9603. return $level;
  9604. }
  9605. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9606. {
  9607. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9608. $selectedLiteral = array_shift($literals);
  9609. if (count($literals)) {
  9610. $this->branches[] = array($literals, $level);
  9611. }
  9612. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9613. }
  9614. protected function analyze($level, Rule $rule)
  9615. {
  9616. $analyzedRule = $rule;
  9617. $ruleLevel = 1;
  9618. $num = 0;
  9619. $l1num = 0;
  9620. $seen = array();
  9621. $learnedLiterals = array(null);
  9622. $decisionId = count($this->decisions);
  9623. $this->learnedPool[] = array();
  9624. while (true) {
  9625. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9626. foreach ($rule->getLiterals() as $literal) {
  9627. if ($this->decisions->satisfy($literal)) {
  9628. continue;
  9629. }
  9630. if (isset($seen[abs($literal)])) {
  9631. continue;
  9632. }
  9633. $seen[abs($literal)] = true;
  9634. $l = $this->decisions->decisionLevel($literal);
  9635. if (1 === $l) {
  9636. $l1num++;
  9637. } elseif ($level === $l) {
  9638. $num++;
  9639. } else {
  9640. $learnedLiterals[] = $literal;
  9641. if ($l > $ruleLevel) {
  9642. $ruleLevel = $l;
  9643. }
  9644. }
  9645. }
  9646. $l1retry = true;
  9647. while ($l1retry) {
  9648. $l1retry = false;
  9649. if (!$num && !--$l1num) {
  9650. break 2;
  9651. }
  9652. while (true) {
  9653. if ($decisionId <= 0) {
  9654. throw new SolverBugException(
  9655. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9656. );
  9657. }
  9658. $decisionId--;
  9659. $decision = $this->decisions->atOffset($decisionId);
  9660. $literal = $decision[Decisions::DECISION_LITERAL];
  9661. if (isset($seen[abs($literal)])) {
  9662. break;
  9663. }
  9664. }
  9665. unset($seen[abs($literal)]);
  9666. if ($num && 0 === --$num) {
  9667. if ($literal < 0) {
  9668. $this->testFlagLearnedPositiveLiteral = true;
  9669. }
  9670. $learnedLiterals[0] = -$literal;
  9671. if (!$l1num) {
  9672. break 2;
  9673. }
  9674. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9675. if ($i !== 0) {
  9676. unset($seen[abs($learnedLiteral)]);
  9677. }
  9678. }
  9679. $l1num++;
  9680. $l1retry = true;
  9681. }
  9682. }
  9683. $decision = $this->decisions->atOffset($decisionId);
  9684. $rule = $decision[Decisions::DECISION_REASON];
  9685. }
  9686. $why = count($this->learnedPool) - 1;
  9687. if (!$learnedLiterals[0]) {
  9688. throw new SolverBugException(
  9689. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9690. );
  9691. }
  9692. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9693. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9694. }
  9695. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9696. {
  9697. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9698. $why = spl_object_hash($conflictRule);
  9699. $learnedWhy = $this->learnedWhy[$why];
  9700. $problemRules = $this->learnedPool[$learnedWhy];
  9701. foreach ($problemRules as $problemRule) {
  9702. $this->analyzeUnsolvableRule($problem, $problemRule);
  9703. }
  9704. return;
  9705. }
  9706. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9707. return;
  9708. }
  9709. $problem->nextSection();
  9710. $problem->addRule($conflictRule);
  9711. }
  9712. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9713. {
  9714. $problem = new Problem($this->pool);
  9715. $problem->addRule($conflictRule);
  9716. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9717. $this->problems[] = $problem;
  9718. $seen = array();
  9719. $literals = $conflictRule->getLiterals();
  9720. foreach ($literals as $literal) {
  9721. if ($this->decisions->satisfy($literal)) {
  9722. continue;
  9723. }
  9724. $seen[abs($literal)] = true;
  9725. }
  9726. foreach ($this->decisions as $decision) {
  9727. $literal = $decision[Decisions::DECISION_LITERAL];
  9728. if (!isset($seen[abs($literal)])) {
  9729. continue;
  9730. }
  9731. $why = $decision[Decisions::DECISION_REASON];
  9732. $problem->addRule($why);
  9733. $this->analyzeUnsolvableRule($problem, $why);
  9734. $literals = $why->getLiterals();
  9735. foreach ($literals as $literal) {
  9736. if ($this->decisions->satisfy($literal)) {
  9737. continue;
  9738. }
  9739. $seen[abs($literal)] = true;
  9740. }
  9741. }
  9742. if ($disableRules) {
  9743. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9744. $this->disableProblem($reason['rule']);
  9745. }
  9746. $this->resetSolver();
  9747. return 1;
  9748. }
  9749. return 0;
  9750. }
  9751. private function disableProblem(Rule $why)
  9752. {
  9753. $job = $why->getJob();
  9754. if (!$job) {
  9755. $why->disable();
  9756. return;
  9757. }
  9758. foreach ($this->rules as $rule) {
  9759. if ($job === $rule->getJob()) {
  9760. $rule->disable();
  9761. }
  9762. }
  9763. }
  9764. private function resetSolver()
  9765. {
  9766. $this->decisions->reset();
  9767. $this->propagateIndex = 0;
  9768. $this->branches = array();
  9769. $this->enableDisableLearnedRules();
  9770. $this->makeAssertionRuleDecisions();
  9771. }
  9772. private function enableDisableLearnedRules()
  9773. {
  9774. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9775. $why = $this->learnedWhy[spl_object_hash($rule)];
  9776. $problemRules = $this->learnedPool[$why];
  9777. $foundDisabled = false;
  9778. foreach ($problemRules as $problemRule) {
  9779. if ($problemRule->isDisabled()) {
  9780. $foundDisabled = true;
  9781. break;
  9782. }
  9783. }
  9784. if ($foundDisabled && $rule->isEnabled()) {
  9785. $rule->disable();
  9786. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9787. $rule->enable();
  9788. }
  9789. }
  9790. }
  9791. private function runSat($disableRules = true)
  9792. {
  9793. $this->propagateIndex = 0;
  9794. $decisionQueue = array();
  9795. $decisionSupplementQueue = array();
  9796. $disableRules = array();
  9797. $level = 1;
  9798. $systemLevel = $level + 1;
  9799. $installedPos = 0;
  9800. while (true) {
  9801. if (1 === $level) {
  9802. $conflictRule = $this->propagate($level);
  9803. if (null !== $conflictRule) {
  9804. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9805. continue;
  9806. }
  9807. return;
  9808. }
  9809. }
  9810. if ($level < $systemLevel) {
  9811. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9812. foreach ($iterator as $rule) {
  9813. if ($rule->isEnabled()) {
  9814. $decisionQueue = array();
  9815. $noneSatisfied = true;
  9816. foreach ($rule->getLiterals() as $literal) {
  9817. if ($this->decisions->satisfy($literal)) {
  9818. $noneSatisfied = false;
  9819. break;
  9820. }
  9821. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9822. $decisionQueue[] = $literal;
  9823. }
  9824. }
  9825. if ($noneSatisfied && count($decisionQueue)) {
  9826. if (count($this->installed) != count($this->updateMap)) {
  9827. $prunedQueue = array();
  9828. foreach ($decisionQueue as $literal) {
  9829. if (isset($this->installedMap[abs($literal)])) {
  9830. $prunedQueue[] = $literal;
  9831. if (isset($this->updateMap[abs($literal)])) {
  9832. $prunedQueue = $decisionQueue;
  9833. break;
  9834. }
  9835. }
  9836. }
  9837. $decisionQueue = $prunedQueue;
  9838. }
  9839. }
  9840. if ($noneSatisfied && count($decisionQueue)) {
  9841. $oLevel = $level;
  9842. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9843. if (0 === $level) {
  9844. return;
  9845. }
  9846. if ($level <= $oLevel) {
  9847. break;
  9848. }
  9849. }
  9850. }
  9851. }
  9852. $systemLevel = $level + 1;
  9853. $iterator->next();
  9854. if ($iterator->valid()) {
  9855. continue;
  9856. }
  9857. }
  9858. if ($level < $systemLevel) {
  9859. $systemLevel = $level;
  9860. }
  9861. $rulesCount = count($this->rules);
  9862. $pass = 1;
  9863. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9864. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9865. if ($i == $rulesCount) {
  9866. if (1 === $pass) {
  9867. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9868. } else {
  9869. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9870. }
  9871. $i = 0;
  9872. $pass++;
  9873. }
  9874. $rule = $this->rules->ruleById[$i];
  9875. $literals = $rule->getLiterals();
  9876. if ($rule->isDisabled()) {
  9877. continue;
  9878. }
  9879. $decisionQueue = array();
  9880. foreach ($literals as $literal) {
  9881. if ($literal <= 0) {
  9882. if (!$this->decisions->decidedInstall($literal)) {
  9883. continue 2;
  9884. }
  9885. } else {
  9886. if ($this->decisions->decidedInstall($literal)) {
  9887. continue 2;
  9888. }
  9889. if ($this->decisions->undecided($literal)) {
  9890. $decisionQueue[] = $literal;
  9891. }
  9892. }
  9893. }
  9894. if (count($decisionQueue) < 2) {
  9895. continue;
  9896. }
  9897. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9898. if (0 === $level) {
  9899. return;
  9900. }
  9901. $rulesCount = count($this->rules);
  9902. $n = -1;
  9903. }
  9904. if ($level < $systemLevel) {
  9905. continue;
  9906. }
  9907. if (count($this->branches)) {
  9908. $lastLiteral = null;
  9909. $lastLevel = null;
  9910. $lastBranchIndex = 0;
  9911. $lastBranchOffset = 0;
  9912. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9913. list($literals, $l) = $this->branches[$i];
  9914. foreach ($literals as $offset => $literal) {
  9915. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9916. $lastLiteral = $literal;
  9917. $lastBranchIndex = $i;
  9918. $lastBranchOffset = $offset;
  9919. $lastLevel = $l;
  9920. }
  9921. }
  9922. }
  9923. if ($lastLiteral) {
  9924. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9925. $level = $lastLevel;
  9926. $this->revert($level);
  9927. $why = $this->decisions->lastReason();
  9928. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9929. if ($level == 0) {
  9930. return;
  9931. }
  9932. continue;
  9933. }
  9934. }
  9935. break;
  9936. }
  9937. }
  9938. }
  9939. <?php
  9940. namespace Composer\DependencyResolver;
  9941. class SolverBugException extends \RuntimeException
  9942. {
  9943. public function __construct($message)
  9944. {
  9945. parent::__construct(
  9946. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9947. "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"
  9948. );
  9949. }
  9950. }
  9951. <?php
  9952. namespace Composer\DependencyResolver;
  9953. use Composer\Util\IniHelper;
  9954. class SolverProblemsException extends \RuntimeException
  9955. {
  9956. protected $problems;
  9957. protected $installedMap;
  9958. public function __construct(array $problems, array $installedMap)
  9959. {
  9960. $this->problems = $problems;
  9961. $this->installedMap = $installedMap;
  9962. parent::__construct($this->createMessage(), 2);
  9963. }
  9964. protected function createMessage()
  9965. {
  9966. $text = "\n";
  9967. $hasExtensionProblems = false;
  9968. foreach ($this->problems as $i => $problem) {
  9969. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9970. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9971. $hasExtensionProblems = true;
  9972. }
  9973. }
  9974. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9975. $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 - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9976. }
  9977. if ($hasExtensionProblems) {
  9978. $text .= $this->createExtensionHint();
  9979. }
  9980. return $text;
  9981. }
  9982. public function getProblems()
  9983. {
  9984. return $this->problems;
  9985. }
  9986. private function createExtensionHint()
  9987. {
  9988. $paths = IniHelper::getAll();
  9989. if (count($paths) === 1 && empty($paths[0])) {
  9990. return '';
  9991. }
  9992. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9993. $text .= implode("\n - ", $paths);
  9994. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9995. return $text;
  9996. }
  9997. private function hasExtensionProblems(array $reasonSets)
  9998. {
  9999. foreach ($reasonSets as $reasonSet) {
  10000. foreach ($reasonSet as $reason) {
  10001. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10002. return true;
  10003. }
  10004. }
  10005. }
  10006. return false;
  10007. }
  10008. }
  10009. <?php
  10010. namespace Composer\DependencyResolver;
  10011. use Composer\Package\AliasPackage;
  10012. class Transaction
  10013. {
  10014. protected $policy;
  10015. protected $pool;
  10016. protected $installedMap;
  10017. protected $decisions;
  10018. protected $transaction;
  10019. public function __construct($policy, $pool, $installedMap, $decisions)
  10020. {
  10021. $this->policy = $policy;
  10022. $this->pool = $pool;
  10023. $this->installedMap = $installedMap;
  10024. $this->decisions = $decisions;
  10025. $this->transaction = array();
  10026. }
  10027. public function getOperations()
  10028. {
  10029. $installMeansUpdateMap = $this->findUpdates();
  10030. $updateMap = array();
  10031. $installMap = array();
  10032. $uninstallMap = array();
  10033. foreach ($this->decisions as $i => $decision) {
  10034. $literal = $decision[Decisions::DECISION_LITERAL];
  10035. $reason = $decision[Decisions::DECISION_REASON];
  10036. $package = $this->pool->literalToPackage($literal);
  10037. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10038. continue;
  10039. }
  10040. if ($literal > 0) {
  10041. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10042. $source = $installMeansUpdateMap[abs($literal)];
  10043. $updateMap[$package->id] = array(
  10044. 'package' => $package,
  10045. 'source' => $source,
  10046. 'reason' => $reason,
  10047. );
  10048. unset($installMeansUpdateMap[abs($literal)]);
  10049. $ignoreRemove[$source->id] = true;
  10050. } else {
  10051. $installMap[$package->id] = array(
  10052. 'package' => $package,
  10053. 'reason' => $reason,
  10054. );
  10055. }
  10056. }
  10057. }
  10058. foreach ($this->decisions as $i => $decision) {
  10059. $literal = $decision[Decisions::DECISION_LITERAL];
  10060. $reason = $decision[Decisions::DECISION_REASON];
  10061. $package = $this->pool->literalToPackage($literal);
  10062. if ($literal <= 0 &&
  10063. isset($this->installedMap[$package->id]) &&
  10064. !isset($ignoreRemove[$package->id])) {
  10065. $uninstallMap[$package->id] = array(
  10066. 'package' => $package,
  10067. 'reason' => $reason,
  10068. );
  10069. }
  10070. }
  10071. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10072. return $this->transaction;
  10073. }
  10074. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10075. {
  10076. $queue = array_map(
  10077. function ($operation) {
  10078. return $operation['package'];
  10079. },
  10080. $this->findRootPackages($installMap, $updateMap)
  10081. );
  10082. $visited = array();
  10083. while (!empty($queue)) {
  10084. $package = array_pop($queue);
  10085. $packageId = $package->id;
  10086. if (!isset($visited[$packageId])) {
  10087. $queue[] = $package;
  10088. if ($package instanceof AliasPackage) {
  10089. $queue[] = $package->getAliasOf();
  10090. } else {
  10091. foreach ($package->getRequires() as $link) {
  10092. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10093. foreach ($possibleRequires as $require) {
  10094. $queue[] = $require;
  10095. }
  10096. }
  10097. }
  10098. $visited[$package->id] = true;
  10099. } else {
  10100. if (isset($installMap[$packageId])) {
  10101. $this->install(
  10102. $installMap[$packageId]['package'],
  10103. $installMap[$packageId]['reason']
  10104. );
  10105. unset($installMap[$packageId]);
  10106. }
  10107. if (isset($updateMap[$packageId])) {
  10108. $this->update(
  10109. $updateMap[$packageId]['source'],
  10110. $updateMap[$packageId]['package'],
  10111. $updateMap[$packageId]['reason']
  10112. );
  10113. unset($updateMap[$packageId]);
  10114. }
  10115. }
  10116. }
  10117. foreach ($uninstallMap as $uninstall) {
  10118. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10119. }
  10120. }
  10121. protected function findRootPackages($installMap, $updateMap)
  10122. {
  10123. $packages = $installMap + $updateMap;
  10124. $roots = $packages;
  10125. foreach ($packages as $packageId => $operation) {
  10126. $package = $operation['package'];
  10127. if (!isset($roots[$packageId])) {
  10128. continue;
  10129. }
  10130. foreach ($package->getRequires() as $link) {
  10131. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10132. foreach ($possibleRequires as $require) {
  10133. if ($require !== $package) {
  10134. unset($roots[$require->id]);
  10135. }
  10136. }
  10137. }
  10138. }
  10139. return $roots;
  10140. }
  10141. protected function findUpdates()
  10142. {
  10143. $installMeansUpdateMap = array();
  10144. foreach ($this->decisions as $i => $decision) {
  10145. $literal = $decision[Decisions::DECISION_LITERAL];
  10146. $package = $this->pool->literalToPackage($literal);
  10147. if ($package instanceof AliasPackage) {
  10148. continue;
  10149. }
  10150. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10151. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10152. $literals = array($package->id);
  10153. foreach ($updates as $update) {
  10154. $literals[] = $update->id;
  10155. }
  10156. foreach ($literals as $updateLiteral) {
  10157. if ($updateLiteral !== $literal) {
  10158. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10159. }
  10160. }
  10161. }
  10162. }
  10163. return $installMeansUpdateMap;
  10164. }
  10165. protected function install($package, $reason)
  10166. {
  10167. if ($package instanceof AliasPackage) {
  10168. return $this->markAliasInstalled($package, $reason);
  10169. }
  10170. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10171. }
  10172. protected function update($from, $to, $reason)
  10173. {
  10174. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10175. }
  10176. protected function uninstall($package, $reason)
  10177. {
  10178. if ($package instanceof AliasPackage) {
  10179. return $this->markAliasUninstalled($package, $reason);
  10180. }
  10181. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10182. }
  10183. protected function markAliasInstalled($package, $reason)
  10184. {
  10185. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10186. }
  10187. protected function markAliasUninstalled($package, $reason)
  10188. {
  10189. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10190. }
  10191. }
  10192. <?php
  10193. namespace Composer\Downloader;
  10194. use Composer\Package\PackageInterface;
  10195. use Symfony\Component\Finder\Finder;
  10196. use Composer\IO\IOInterface;
  10197. abstract class ArchiveDownloader extends FileDownloader
  10198. {
  10199. public function download(PackageInterface $package, $path, $output = true)
  10200. {
  10201. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10202. $retries = 3;
  10203. while ($retries--) {
  10204. $fileName = parent::download($package, $path, $output);
  10205. if ($output) {
  10206. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10207. }
  10208. try {
  10209. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10210. try {
  10211. $this->extract($fileName, $temporaryDir);
  10212. } catch (\Exception $e) {
  10213. parent::clearLastCacheWrite($package);
  10214. throw $e;
  10215. }
  10216. $this->filesystem->unlink($fileName);
  10217. $contentDir = $this->getFolderContent($temporaryDir);
  10218. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10219. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10220. }
  10221. foreach ($contentDir as $file) {
  10222. $file = (string) $file;
  10223. $this->filesystem->rename($file, $path . '/' . basename($file));
  10224. }
  10225. $this->filesystem->removeDirectory($temporaryDir);
  10226. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10227. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10228. }
  10229. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10230. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10231. }
  10232. } catch (\Exception $e) {
  10233. $this->filesystem->removeDirectory($path);
  10234. $this->filesystem->removeDirectory($temporaryDir);
  10235. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10236. $this->io->writeError('');
  10237. if ($this->io->isDebug()) {
  10238. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10239. } else {
  10240. $this->io->writeError(' Invalid zip file, retrying...');
  10241. }
  10242. usleep(500000);
  10243. continue;
  10244. }
  10245. throw $e;
  10246. }
  10247. break;
  10248. }
  10249. }
  10250. protected function getFileName(PackageInterface $package, $path)
  10251. {
  10252. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10253. }
  10254. abstract protected function extract($file, $path);
  10255. private function getFolderContent($dir)
  10256. {
  10257. $finder = Finder::create()
  10258. ->ignoreVCS(false)
  10259. ->ignoreDotFiles(false)
  10260. ->notName('.DS_Store')
  10261. ->depth(0)
  10262. ->in($dir);
  10263. return iterator_to_array($finder);
  10264. }
  10265. }
  10266. <?php
  10267. namespace Composer\Downloader;
  10268. use Composer\Package\PackageInterface;
  10269. interface ChangeReportInterface
  10270. {
  10271. public function getLocalChanges(PackageInterface $package, $path);
  10272. }
  10273. <?php
  10274. namespace Composer\Downloader;
  10275. use Composer\Package\PackageInterface;
  10276. use Composer\IO\IOInterface;
  10277. use Composer\Util\Filesystem;
  10278. class DownloadManager
  10279. {
  10280. private $io;
  10281. private $preferDist = false;
  10282. private $preferSource = false;
  10283. private $packagePreferences = array();
  10284. private $filesystem;
  10285. private $downloaders = array();
  10286. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10287. {
  10288. $this->io = $io;
  10289. $this->preferSource = $preferSource;
  10290. $this->filesystem = $filesystem ?: new Filesystem();
  10291. }
  10292. public function setPreferSource($preferSource)
  10293. {
  10294. $this->preferSource = $preferSource;
  10295. return $this;
  10296. }
  10297. public function setPreferDist($preferDist)
  10298. {
  10299. $this->preferDist = $preferDist;
  10300. return $this;
  10301. }
  10302. public function setPreferences(array $preferences)
  10303. {
  10304. $this->packagePreferences = $preferences;
  10305. return $this;
  10306. }
  10307. public function setOutputProgress($outputProgress)
  10308. {
  10309. foreach ($this->downloaders as $downloader) {
  10310. $downloader->setOutputProgress($outputProgress);
  10311. }
  10312. return $this;
  10313. }
  10314. public function setDownloader($type, DownloaderInterface $downloader)
  10315. {
  10316. $type = strtolower($type);
  10317. $this->downloaders[$type] = $downloader;
  10318. return $this;
  10319. }
  10320. public function getDownloader($type)
  10321. {
  10322. $type = strtolower($type);
  10323. if (!isset($this->downloaders[$type])) {
  10324. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10325. }
  10326. return $this->downloaders[$type];
  10327. }
  10328. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10329. {
  10330. $installationSource = $package->getInstallationSource();
  10331. if ('metapackage' === $package->getType()) {
  10332. return;
  10333. }
  10334. if ('dist' === $installationSource) {
  10335. $downloader = $this->getDownloader($package->getDistType());
  10336. } elseif ('source' === $installationSource) {
  10337. $downloader = $this->getDownloader($package->getSourceType());
  10338. } else {
  10339. throw new \InvalidArgumentException(
  10340. 'Package '.$package.' seems not been installed properly'
  10341. );
  10342. }
  10343. if ($installationSource !== $downloader->getInstallationSource()) {
  10344. throw new \LogicException(sprintf(
  10345. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10346. get_class($downloader),
  10347. $downloader->getInstallationSource(),
  10348. $installationSource,
  10349. $package
  10350. ));
  10351. }
  10352. return $downloader;
  10353. }
  10354. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10355. {
  10356. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10357. $sourceType = $package->getSourceType();
  10358. $distType = $package->getDistType();
  10359. $sources = array();
  10360. if ($sourceType) {
  10361. $sources[] = 'source';
  10362. }
  10363. if ($distType) {
  10364. $sources[] = 'dist';
  10365. }
  10366. if (empty($sources)) {
  10367. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10368. }
  10369. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10370. $sources = array_reverse($sources);
  10371. }
  10372. $this->filesystem->ensureDirectoryExists($targetDir);
  10373. foreach ($sources as $i => $source) {
  10374. if (isset($e)) {
  10375. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10376. }
  10377. $package->setInstallationSource($source);
  10378. try {
  10379. $downloader = $this->getDownloaderForInstalledPackage($package);
  10380. if ($downloader) {
  10381. $downloader->download($package, $targetDir);
  10382. }
  10383. break;
  10384. } catch (\RuntimeException $e) {
  10385. if ($i === count($sources) - 1) {
  10386. throw $e;
  10387. }
  10388. $this->io->writeError(
  10389. ' <warning>Failed to download '.
  10390. $package->getPrettyName().
  10391. ' from ' . $source . ': '.
  10392. $e->getMessage().'</warning>'
  10393. );
  10394. }
  10395. }
  10396. }
  10397. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10398. {
  10399. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10400. if (!$downloader) {
  10401. return;
  10402. }
  10403. $installationSource = $initial->getInstallationSource();
  10404. if ('dist' === $installationSource) {
  10405. $initialType = $initial->getDistType();
  10406. $targetType = $target->getDistType();
  10407. } else {
  10408. $initialType = $initial->getSourceType();
  10409. $targetType = $target->getSourceType();
  10410. }
  10411. if ($target->isDev() && 'dist' === $installationSource) {
  10412. $downloader->remove($initial, $targetDir);
  10413. $this->download($target, $targetDir);
  10414. return;
  10415. }
  10416. if ($initialType === $targetType) {
  10417. $target->setInstallationSource($installationSource);
  10418. try {
  10419. $downloader->update($initial, $target, $targetDir);
  10420. return;
  10421. } catch (\RuntimeException $e) {
  10422. if (!$this->io->isInteractive()) {
  10423. throw $e;
  10424. }
  10425. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10426. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10427. throw $e;
  10428. }
  10429. }
  10430. }
  10431. $downloader->remove($initial, $targetDir);
  10432. $this->download($target, $targetDir, 'source' === $installationSource);
  10433. }
  10434. public function remove(PackageInterface $package, $targetDir)
  10435. {
  10436. $downloader = $this->getDownloaderForInstalledPackage($package);
  10437. if ($downloader) {
  10438. $downloader->remove($package, $targetDir);
  10439. }
  10440. }
  10441. protected function resolvePackageInstallPreference(PackageInterface $package)
  10442. {
  10443. foreach ($this->packagePreferences as $pattern => $preference) {
  10444. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10445. if (preg_match($pattern, $package->getName())) {
  10446. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10447. return 'dist';
  10448. }
  10449. return 'source';
  10450. }
  10451. }
  10452. return $package->isDev() ? 'source' : 'dist';
  10453. }
  10454. }
  10455. <?php
  10456. namespace Composer\Downloader;
  10457. use Composer\Package\PackageInterface;
  10458. interface DownloaderInterface
  10459. {
  10460. public function getInstallationSource();
  10461. public function download(PackageInterface $package, $path);
  10462. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10463. public function remove(PackageInterface $package, $path);
  10464. public function setOutputProgress($outputProgress);
  10465. }
  10466. <?php
  10467. namespace Composer\Downloader;
  10468. use Composer\Package\PackageInterface;
  10469. interface DvcsDownloaderInterface
  10470. {
  10471. public function getUnpushedChanges(PackageInterface $package, $path);
  10472. }
  10473. <?php
  10474. namespace Composer\Downloader;
  10475. use Composer\Config;
  10476. use Composer\Cache;
  10477. use Composer\Factory;
  10478. use Composer\IO\IOInterface;
  10479. use Composer\IO\NullIO;
  10480. use Composer\Package\Comparer\Comparer;
  10481. use Composer\Package\PackageInterface;
  10482. use Composer\Package\Version\VersionParser;
  10483. use Composer\Plugin\PluginEvents;
  10484. use Composer\Plugin\PreFileDownloadEvent;
  10485. use Composer\EventDispatcher\EventDispatcher;
  10486. use Composer\Util\Filesystem;
  10487. use Composer\Util\RemoteFilesystem;
  10488. use Composer\Util\Url as UrlUtil;
  10489. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10490. {
  10491. protected $io;
  10492. protected $config;
  10493. protected $rfs;
  10494. protected $filesystem;
  10495. protected $cache;
  10496. protected $outputProgress = true;
  10497. private $lastCacheWrites = array();
  10498. private $eventDispatcher;
  10499. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10500. {
  10501. $this->io = $io;
  10502. $this->config = $config;
  10503. $this->eventDispatcher = $eventDispatcher;
  10504. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10505. $this->filesystem = $filesystem ?: new Filesystem();
  10506. $this->cache = $cache;
  10507. if ($this->cache && $this->cache->gcIsNecessary()) {
  10508. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10509. }
  10510. }
  10511. public function getInstallationSource()
  10512. {
  10513. return 'dist';
  10514. }
  10515. public function download(PackageInterface $package, $path, $output = true)
  10516. {
  10517. if (!$package->getDistUrl()) {
  10518. throw new \InvalidArgumentException('The given package is missing url information');
  10519. }
  10520. if ($output) {
  10521. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10522. }
  10523. $urls = $package->getDistUrls();
  10524. while ($url = array_shift($urls)) {
  10525. try {
  10526. $fileName = $this->doDownload($package, $path, $url);
  10527. break;
  10528. } catch (\Exception $e) {
  10529. if ($this->io->isDebug()) {
  10530. $this->io->writeError('');
  10531. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10532. } elseif (count($urls)) {
  10533. $this->io->writeError('');
  10534. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10535. }
  10536. if (!count($urls)) {
  10537. throw $e;
  10538. }
  10539. }
  10540. }
  10541. if ($output) {
  10542. $this->io->writeError('');
  10543. }
  10544. return $fileName;
  10545. }
  10546. protected function doDownload(PackageInterface $package, $path, $url)
  10547. {
  10548. $this->filesystem->emptyDirectory($path);
  10549. $fileName = $this->getFileName($package, $path);
  10550. $processedUrl = $this->processUrl($package, $url);
  10551. $origin = RemoteFilesystem::getOrigin($processedUrl);
  10552. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10553. if ($this->eventDispatcher) {
  10554. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10555. }
  10556. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10557. try {
  10558. $checksum = $package->getDistSha1Checksum();
  10559. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10560. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10561. $this->io->writeError('Loading from cache', false);
  10562. } else {
  10563. if (!$this->outputProgress) {
  10564. $this->io->writeError('Downloading', false);
  10565. }
  10566. $retries = 3;
  10567. while ($retries--) {
  10568. try {
  10569. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10570. break;
  10571. } catch (TransportException $e) {
  10572. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10573. throw $e;
  10574. }
  10575. $this->io->writeError('');
  10576. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10577. usleep(500000);
  10578. }
  10579. }
  10580. if (!$this->outputProgress) {
  10581. $this->io->writeError(' (<comment>100%</comment>)', false);
  10582. }
  10583. if ($this->cache) {
  10584. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10585. $this->cache->copyFrom($cacheKey, $fileName);
  10586. }
  10587. }
  10588. if (!file_exists($fileName)) {
  10589. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10590. .' directory is writable and you have internet connectivity');
  10591. }
  10592. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10593. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10594. }
  10595. } catch (\Exception $e) {
  10596. $this->filesystem->removeDirectory($path);
  10597. $this->clearLastCacheWrite($package);
  10598. throw $e;
  10599. }
  10600. return $fileName;
  10601. }
  10602. public function setOutputProgress($outputProgress)
  10603. {
  10604. $this->outputProgress = $outputProgress;
  10605. return $this;
  10606. }
  10607. protected function clearLastCacheWrite(PackageInterface $package)
  10608. {
  10609. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10610. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10611. unset($this->lastCacheWrites[$package->getName()]);
  10612. }
  10613. }
  10614. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10615. {
  10616. $name = $target->getName();
  10617. $from = $initial->getFullPrettyVersion();
  10618. $to = $target->getFullPrettyVersion();
  10619. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10620. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10621. $this->remove($initial, $path, false);
  10622. $this->download($target, $path, false);
  10623. $this->io->writeError('');
  10624. }
  10625. public function remove(PackageInterface $package, $path, $output = true)
  10626. {
  10627. if ($output) {
  10628. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10629. }
  10630. if (!$this->filesystem->removeDirectory($path)) {
  10631. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10632. }
  10633. }
  10634. protected function getFileName(PackageInterface $package, $path)
  10635. {
  10636. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10637. }
  10638. protected function processUrl(PackageInterface $package, $url)
  10639. {
  10640. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10641. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10642. }
  10643. if ($package->getDistReference()) {
  10644. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10645. }
  10646. return $url;
  10647. }
  10648. private function getCacheKey(PackageInterface $package, $processedUrl)
  10649. {
  10650. $cacheKey = sha1($processedUrl);
  10651. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10652. }
  10653. public function getLocalChanges(PackageInterface $package, $targetDir)
  10654. {
  10655. $prevIO = $this->io;
  10656. $prevProgress = $this->outputProgress;
  10657. $this->io = new NullIO;
  10658. $this->io->loadConfiguration($this->config);
  10659. $this->outputProgress = false;
  10660. $e = null;
  10661. try {
  10662. $this->download($package, $targetDir.'_compare', false);
  10663. $comparer = new Comparer();
  10664. $comparer->setSource($targetDir.'_compare');
  10665. $comparer->setUpdate($targetDir);
  10666. $comparer->doCompare();
  10667. $output = $comparer->getChanged(true, true);
  10668. $this->filesystem->removeDirectory($targetDir.'_compare');
  10669. } catch (\Exception $e) {
  10670. }
  10671. $this->io = $prevIO;
  10672. $this->outputProgress = $prevProgress;
  10673. if ($e) {
  10674. throw $e;
  10675. }
  10676. return trim($output);
  10677. }
  10678. }
  10679. <?php
  10680. namespace Composer\Downloader;
  10681. class FilesystemException extends \Exception
  10682. {
  10683. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10684. {
  10685. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10686. }
  10687. }
  10688. <?php
  10689. namespace Composer\Downloader;
  10690. use Composer\Package\PackageInterface;
  10691. use Composer\Util\ProcessExecutor;
  10692. class FossilDownloader extends VcsDownloader
  10693. {
  10694. public function doDownload(PackageInterface $package, $path, $url)
  10695. {
  10696. $this->config->prohibitUrlByConfig($url, $this->io);
  10697. $url = ProcessExecutor::escape($url);
  10698. $ref = ProcessExecutor::escape($package->getSourceReference());
  10699. $repoFile = $path . '.fossil';
  10700. $this->io->writeError("Cloning ".$package->getSourceReference());
  10701. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10702. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10703. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10704. }
  10705. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10706. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10707. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10708. }
  10709. $command = sprintf('fossil update %s', $ref);
  10710. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10711. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10712. }
  10713. }
  10714. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10715. {
  10716. $this->config->prohibitUrlByConfig($url, $this->io);
  10717. $url = ProcessExecutor::escape($url);
  10718. $ref = ProcessExecutor::escape($target->getSourceReference());
  10719. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10720. if (!$this->hasMetadataRepository($path)) {
  10721. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10722. }
  10723. $command = sprintf('fossil pull && fossil up %s', $ref);
  10724. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10725. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10726. }
  10727. }
  10728. public function getLocalChanges(PackageInterface $package, $path)
  10729. {
  10730. if (!$this->hasMetadataRepository($path)) {
  10731. return null;
  10732. }
  10733. $this->process->execute('fossil changes', $output, realpath($path));
  10734. return trim($output) ?: null;
  10735. }
  10736. protected function getCommitLogs($fromReference, $toReference, $path)
  10737. {
  10738. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10739. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10740. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10741. }
  10742. $log = '';
  10743. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10744. foreach ($this->process->splitLines($output) as $line) {
  10745. if (preg_match($match, $line)) {
  10746. break;
  10747. }
  10748. $log .= $line;
  10749. }
  10750. return $log;
  10751. }
  10752. protected function hasMetadataRepository($path)
  10753. {
  10754. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10755. }
  10756. }
  10757. <?php
  10758. namespace Composer\Downloader;
  10759. use Composer\Config;
  10760. use Composer\IO\IOInterface;
  10761. use Composer\Package\PackageInterface;
  10762. use Composer\Util\Filesystem;
  10763. use Composer\Util\Git as GitUtil;
  10764. use Composer\Util\Platform;
  10765. use Composer\Util\ProcessExecutor;
  10766. use Composer\Cache;
  10767. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10768. {
  10769. private $hasStashedChanges = false;
  10770. private $hasDiscardedChanges = false;
  10771. private $gitUtil;
  10772. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10773. {
  10774. parent::__construct($io, $config, $process, $fs);
  10775. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10776. }
  10777. public function doDownload(PackageInterface $package, $path, $url)
  10778. {
  10779. GitUtil::cleanEnv();
  10780. $path = $this->normalizePath($path);
  10781. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10782. $ref = $package->getSourceReference();
  10783. $flag = Platform::isWindows() ? '/D ' : '';
  10784. $gitVersion = $this->gitUtil->getVersion();
  10785. $msg = "Cloning ".$this->getShortHash($ref);
  10786. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10787. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  10788. $this->io->writeError('', true, IOInterface::DEBUG);
  10789. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10790. try {
  10791. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10792. if (is_dir($cachePath)) {
  10793. $command =
  10794. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10795. . '&& cd '.$flag.'%path% '
  10796. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10797. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10798. }
  10799. } catch (\RuntimeException $e) {
  10800. }
  10801. }
  10802. $this->io->writeError($msg);
  10803. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10804. return str_replace(
  10805. array('%url%', '%path%', '%cachePath%'),
  10806. array(
  10807. ProcessExecutor::escape($url),
  10808. ProcessExecutor::escape($path),
  10809. ProcessExecutor::escape($cachePath),
  10810. ),
  10811. $command
  10812. );
  10813. };
  10814. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10815. if ($url !== $package->getSourceUrl()) {
  10816. $this->updateOriginUrl($path, $package->getSourceUrl());
  10817. } else {
  10818. $this->setPushUrl($path, $url);
  10819. }
  10820. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10821. if ($package->getDistReference() === $package->getSourceReference()) {
  10822. $package->setDistReference($newRef);
  10823. }
  10824. $package->setSourceReference($newRef);
  10825. }
  10826. }
  10827. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10828. {
  10829. GitUtil::cleanEnv();
  10830. if (!$this->hasMetadataRepository($path)) {
  10831. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10832. }
  10833. $updateOriginUrl = false;
  10834. if (
  10835. 0 === $this->process->execute('git remote -v', $output, $path)
  10836. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10837. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10838. ) {
  10839. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10840. $updateOriginUrl = true;
  10841. }
  10842. }
  10843. $ref = $target->getSourceReference();
  10844. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10845. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10846. $commandCallable = function ($url) use ($command, $ref) {
  10847. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10848. };
  10849. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10850. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10851. if ($target->getDistReference() === $target->getSourceReference()) {
  10852. $target->setDistReference($newRef);
  10853. }
  10854. $target->setSourceReference($newRef);
  10855. }
  10856. if ($updateOriginUrl) {
  10857. $this->updateOriginUrl($path, $target->getSourceUrl());
  10858. }
  10859. }
  10860. public function getLocalChanges(PackageInterface $package, $path)
  10861. {
  10862. GitUtil::cleanEnv();
  10863. if (!$this->hasMetadataRepository($path)) {
  10864. return;
  10865. }
  10866. $command = 'git status --porcelain --untracked-files=no';
  10867. if (0 !== $this->process->execute($command, $output, $path)) {
  10868. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10869. }
  10870. return trim($output) ?: null;
  10871. }
  10872. public function getUnpushedChanges(PackageInterface $package, $path)
  10873. {
  10874. GitUtil::cleanEnv();
  10875. $path = $this->normalizePath($path);
  10876. if (!$this->hasMetadataRepository($path)) {
  10877. return;
  10878. }
  10879. $command = 'git show-ref --head -d';
  10880. if (0 !== $this->process->execute($command, $output, $path)) {
  10881. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10882. }
  10883. $refs = trim($output);
  10884. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10885. return;
  10886. }
  10887. $headRef = $match[1];
  10888. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10889. return;
  10890. }
  10891. $branch = $matches[1][0];
  10892. $unpushedChanges = null;
  10893. for ($i = 0; $i <= 1; $i++) {
  10894. foreach ($matches[1] as $candidate) {
  10895. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10896. $branch = $candidate;
  10897. $remoteBranch = $match[1];
  10898. break;
  10899. }
  10900. }
  10901. if (!isset($remoteBranch)) {
  10902. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10903. } else {
  10904. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10905. if (0 !== $this->process->execute($command, $output, $path)) {
  10906. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10907. }
  10908. $unpushedChanges = trim($output) ?: null;
  10909. }
  10910. if ($unpushedChanges && $i === 0) {
  10911. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10912. }
  10913. if (!$unpushedChanges) {
  10914. break;
  10915. }
  10916. }
  10917. return $unpushedChanges;
  10918. }
  10919. protected function cleanChanges(PackageInterface $package, $path, $update)
  10920. {
  10921. GitUtil::cleanEnv();
  10922. $path = $this->normalizePath($path);
  10923. $unpushed = $this->getUnpushedChanges($package, $path);
  10924. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10925. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10926. }
  10927. if (!$changes = $this->getLocalChanges($package, $path)) {
  10928. return;
  10929. }
  10930. if (!$this->io->isInteractive()) {
  10931. $discardChanges = $this->config->get('discard-changes');
  10932. if (true === $discardChanges) {
  10933. return $this->discardChanges($path);
  10934. }
  10935. if ('stash' === $discardChanges) {
  10936. if (!$update) {
  10937. return parent::cleanChanges($package, $path, $update);
  10938. }
  10939. return $this->stashChanges($path);
  10940. }
  10941. return parent::cleanChanges($package, $path, $update);
  10942. }
  10943. $changes = array_map(function ($elem) {
  10944. return ' '.$elem;
  10945. }, preg_split('{\s*\r?\n\s*}', $changes));
  10946. $this->io->writeError(' <error>The package has modified files:</error>');
  10947. $this->io->writeError(array_slice($changes, 0, 10));
  10948. if (count($changes) > 10) {
  10949. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10950. }
  10951. while (true) {
  10952. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10953. case 'y':
  10954. $this->discardChanges($path);
  10955. break 2;
  10956. case 's':
  10957. if (!$update) {
  10958. goto help;
  10959. }
  10960. $this->stashChanges($path);
  10961. break 2;
  10962. case 'n':
  10963. throw new \RuntimeException('Update aborted');
  10964. case 'v':
  10965. $this->io->writeError($changes);
  10966. break;
  10967. case 'd':
  10968. $this->viewDiff($path);
  10969. break;
  10970. case '?':
  10971. default:
  10972. help:
  10973. $this->io->writeError(array(
  10974. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10975. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10976. ' v - view modified files',
  10977. ' d - view local modifications (diff)',
  10978. ));
  10979. if ($update) {
  10980. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10981. }
  10982. $this->io->writeError(' ? - print help');
  10983. break;
  10984. }
  10985. }
  10986. }
  10987. protected function reapplyChanges($path)
  10988. {
  10989. $path = $this->normalizePath($path);
  10990. if ($this->hasStashedChanges) {
  10991. $this->hasStashedChanges = false;
  10992. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10993. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10994. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10995. }
  10996. }
  10997. $this->hasDiscardedChanges = false;
  10998. }
  10999. protected function updateToCommit($path, $reference, $branch, $date)
  11000. {
  11001. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11002. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11003. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11004. $branches = null;
  11005. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11006. $branches = $output;
  11007. }
  11008. $gitRef = $reference;
  11009. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11010. && $branches
  11011. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11012. ) {
  11013. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11014. if (0 === $this->process->execute($command, $output, $path)) {
  11015. return;
  11016. }
  11017. }
  11018. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11019. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11020. $branch = 'v' . $branch;
  11021. }
  11022. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11023. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11024. if (0 === $this->process->execute($command, $output, $path)
  11025. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11026. ) {
  11027. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11028. if (0 === $this->process->execute($command, $output, $path)) {
  11029. return;
  11030. }
  11031. }
  11032. }
  11033. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11034. if (0 === $this->process->execute($command, $output, $path)) {
  11035. return;
  11036. }
  11037. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11038. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11039. }
  11040. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11041. }
  11042. protected function updateOriginUrl($path, $url)
  11043. {
  11044. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11045. $this->setPushUrl($path, $url);
  11046. }
  11047. protected function setPushUrl($path, $url)
  11048. {
  11049. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11050. $protocols = $this->config->get('github-protocols');
  11051. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11052. if (!in_array('ssh', $protocols, true)) {
  11053. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11054. }
  11055. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11056. $this->process->execute($cmd, $ignoredOutput, $path);
  11057. }
  11058. }
  11059. protected function getCommitLogs($fromReference, $toReference, $path)
  11060. {
  11061. $path = $this->normalizePath($path);
  11062. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11063. if (0 !== $this->process->execute($command, $output, $path)) {
  11064. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11065. }
  11066. return $output;
  11067. }
  11068. protected function discardChanges($path)
  11069. {
  11070. $path = $this->normalizePath($path);
  11071. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  11072. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11073. }
  11074. $this->hasDiscardedChanges = true;
  11075. }
  11076. protected function stashChanges($path)
  11077. {
  11078. $path = $this->normalizePath($path);
  11079. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11080. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11081. }
  11082. $this->hasStashedChanges = true;
  11083. }
  11084. protected function viewDiff($path)
  11085. {
  11086. $path = $this->normalizePath($path);
  11087. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11088. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11089. }
  11090. $this->io->writeError($output);
  11091. }
  11092. protected function normalizePath($path)
  11093. {
  11094. if (Platform::isWindows() && strlen($path) > 0) {
  11095. $basePath = $path;
  11096. $removed = array();
  11097. while (!is_dir($basePath) && $basePath !== '\\') {
  11098. array_unshift($removed, basename($basePath));
  11099. $basePath = dirname($basePath);
  11100. }
  11101. if ($basePath === '\\') {
  11102. return $path;
  11103. }
  11104. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11105. }
  11106. return $path;
  11107. }
  11108. protected function hasMetadataRepository($path)
  11109. {
  11110. $path = $this->normalizePath($path);
  11111. return is_dir($path.'/.git');
  11112. }
  11113. protected function getShortHash($reference)
  11114. {
  11115. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11116. return substr($reference, 0, 10);
  11117. }
  11118. return $reference;
  11119. }
  11120. }
  11121. <?php
  11122. namespace Composer\Downloader;
  11123. use Composer\Config;
  11124. use Composer\Cache;
  11125. use Composer\EventDispatcher\EventDispatcher;
  11126. use Composer\Package\PackageInterface;
  11127. use Composer\Util\Platform;
  11128. use Composer\Util\ProcessExecutor;
  11129. use Composer\Util\RemoteFilesystem;
  11130. use Composer\IO\IOInterface;
  11131. class GzipDownloader extends ArchiveDownloader
  11132. {
  11133. protected $process;
  11134. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11135. {
  11136. $this->process = $process ?: new ProcessExecutor($io);
  11137. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11138. }
  11139. protected function extract($file, $path)
  11140. {
  11141. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11142. if (!Platform::isWindows()) {
  11143. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11144. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11145. return;
  11146. }
  11147. if (extension_loaded('zlib')) {
  11148. $this->extractUsingExt($file, $targetFilepath);
  11149. return;
  11150. }
  11151. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11152. throw new \RuntimeException($processError);
  11153. }
  11154. $this->extractUsingExt($file, $targetFilepath);
  11155. }
  11156. protected function getFileName(PackageInterface $package, $path)
  11157. {
  11158. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11159. }
  11160. private function extractUsingExt($file, $targetFilepath)
  11161. {
  11162. $archiveFile = gzopen($file, 'rb');
  11163. $targetFile = fopen($targetFilepath, 'wb');
  11164. while ($string = gzread($archiveFile, 4096)) {
  11165. fwrite($targetFile, $string, Platform::strlen($string));
  11166. }
  11167. gzclose($archiveFile);
  11168. fclose($targetFile);
  11169. }
  11170. }
  11171. <?php
  11172. namespace Composer\Downloader;
  11173. use Composer\Package\PackageInterface;
  11174. use Composer\Util\ProcessExecutor;
  11175. use Composer\Util\Hg as HgUtils;
  11176. class HgDownloader extends VcsDownloader
  11177. {
  11178. public function doDownload(PackageInterface $package, $path, $url)
  11179. {
  11180. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11181. $cloneCommand = function ($url) use ($path) {
  11182. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11183. };
  11184. $hgUtils->runCommand($cloneCommand, $url, $path);
  11185. $ref = ProcessExecutor::escape($package->getSourceReference());
  11186. $command = sprintf('hg up %s', $ref);
  11187. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11188. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11189. }
  11190. }
  11191. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11192. {
  11193. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11194. $ref = $target->getSourceReference();
  11195. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11196. if (!$this->hasMetadataRepository($path)) {
  11197. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11198. }
  11199. $command = function ($url) use ($ref) {
  11200. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11201. };
  11202. $hgUtils->runCommand($command, $url, $path);
  11203. }
  11204. public function getLocalChanges(PackageInterface $package, $path)
  11205. {
  11206. if (!is_dir($path.'/.hg')) {
  11207. return null;
  11208. }
  11209. $this->process->execute('hg st', $output, realpath($path));
  11210. return trim($output) ?: null;
  11211. }
  11212. protected function getCommitLogs($fromReference, $toReference, $path)
  11213. {
  11214. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11215. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11216. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11217. }
  11218. return $output;
  11219. }
  11220. protected function hasMetadataRepository($path)
  11221. {
  11222. return is_dir($path . '/.hg');
  11223. }
  11224. }
  11225. <?php
  11226. namespace Composer\Downloader;
  11227. use Composer\Package\Archiver\ArchivableFilesFinder;
  11228. use Composer\Package\Dumper\ArrayDumper;
  11229. use Composer\Package\PackageInterface;
  11230. use Composer\Package\Version\VersionGuesser;
  11231. use Composer\Package\Version\VersionParser;
  11232. use Composer\Util\Platform;
  11233. use Composer\Util\ProcessExecutor;
  11234. use Composer\Util\Filesystem as ComposerFilesystem;
  11235. use Symfony\Component\Filesystem\Exception\IOException;
  11236. use Symfony\Component\Filesystem\Filesystem;
  11237. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11238. {
  11239. const STRATEGY_SYMLINK = 10;
  11240. const STRATEGY_MIRROR = 20;
  11241. public function download(PackageInterface $package, $path, $output = true)
  11242. {
  11243. $url = $package->getDistUrl();
  11244. $realUrl = realpath($url);
  11245. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11246. throw new \RuntimeException(sprintf(
  11247. 'Source path "%s" is not found for package %s',
  11248. $url,
  11249. $package->getName()
  11250. ));
  11251. }
  11252. if (realpath($path) === $realUrl) {
  11253. if ($output) {
  11254. $this->io->writeError(sprintf(
  11255. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11256. $package->getName(),
  11257. $package->getFullPrettyVersion()
  11258. ));
  11259. }
  11260. return;
  11261. }
  11262. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11263. throw new \RuntimeException(sprintf(
  11264. 'Package %s cannot install to "%s" inside its source at "%s"',
  11265. $package->getName(),
  11266. realpath($path),
  11267. $realUrl
  11268. ));
  11269. }
  11270. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11271. $currentStrategy = self::STRATEGY_SYMLINK;
  11272. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11273. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11274. if ($mirrorPathRepos) {
  11275. $currentStrategy = self::STRATEGY_MIRROR;
  11276. }
  11277. if (true === $transportOptions['symlink']) {
  11278. $currentStrategy = self::STRATEGY_SYMLINK;
  11279. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11280. } elseif (false === $transportOptions['symlink']) {
  11281. $currentStrategy = self::STRATEGY_MIRROR;
  11282. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11283. }
  11284. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11285. $currentStrategy = self::STRATEGY_MIRROR;
  11286. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11287. }
  11288. $fileSystem = new Filesystem();
  11289. $this->filesystem->removeDirectory($path);
  11290. if ($output) {
  11291. $this->io->writeError(sprintf(
  11292. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11293. $package->getName(),
  11294. $package->getFullPrettyVersion()
  11295. ), false);
  11296. }
  11297. $isFallback = false;
  11298. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11299. try {
  11300. if (Platform::isWindows()) {
  11301. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11302. $this->filesystem->junction($realUrl, $path);
  11303. } else {
  11304. $absolutePath = $path;
  11305. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11306. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11307. }
  11308. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11309. $path = rtrim($path, "/");
  11310. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11311. $fileSystem->symlink($shortestPath, $path);
  11312. }
  11313. } catch (IOException $e) {
  11314. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11315. $this->io->writeError('');
  11316. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11317. $currentStrategy = self::STRATEGY_MIRROR;
  11318. $isFallback = true;
  11319. } else {
  11320. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11321. }
  11322. }
  11323. }
  11324. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11325. $fs = new ComposerFilesystem();
  11326. $realUrl = $fs->normalizePath($realUrl);
  11327. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11328. $iterator = new ArchivableFilesFinder($realUrl, array());
  11329. $fileSystem->mirror($realUrl, $path, $iterator);
  11330. }
  11331. $this->io->writeError('');
  11332. }
  11333. public function remove(PackageInterface $package, $path, $output = true)
  11334. {
  11335. $realUrl = realpath($package->getDistUrl());
  11336. if (realpath($path) === $realUrl) {
  11337. if ($output) {
  11338. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11339. }
  11340. return;
  11341. }
  11342. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11343. if ($output) {
  11344. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11345. }
  11346. if (!$this->filesystem->removeJunction($path)) {
  11347. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11348. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11349. }
  11350. } else {
  11351. parent::remove($package, $path, $output);
  11352. }
  11353. }
  11354. public function getVcsReference(PackageInterface $package, $path)
  11355. {
  11356. $parser = new VersionParser;
  11357. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11358. $dumper = new ArrayDumper;
  11359. $packageConfig = $dumper->dump($package);
  11360. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11361. return $packageVersion['commit'];
  11362. }
  11363. }
  11364. private function safeJunctions()
  11365. {
  11366. return function_exists('proc_open') &&
  11367. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11368. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11369. }
  11370. }
  11371. <?php
  11372. namespace Composer\Downloader;
  11373. use Composer\Util\Filesystem;
  11374. class PearPackageExtractor
  11375. {
  11376. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11377. private $filesystem;
  11378. private $file;
  11379. public function __construct($file)
  11380. {
  11381. if (!is_file($file)) {
  11382. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11383. }
  11384. $this->filesystem = new Filesystem();
  11385. $this->file = $file;
  11386. }
  11387. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11388. {
  11389. $extractionPath = $target.'/tarball';
  11390. try {
  11391. $archive = new \PharData($this->file);
  11392. $archive->extractTo($extractionPath, null, true);
  11393. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11394. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11395. }
  11396. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11397. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11398. $this->filesystem->removeDirectory($extractionPath);
  11399. } catch (\Exception $exception) {
  11400. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11401. }
  11402. }
  11403. private function copyFiles($files, $source, $target, $roles, $vars)
  11404. {
  11405. foreach ($files as $file) {
  11406. $from = $this->combine($source, $file['from']);
  11407. $to = $this->combine($target, $roles[$file['role']]);
  11408. $to = $this->combine($to, $file['to']);
  11409. $tasks = $file['tasks'];
  11410. $this->copyFile($from, $to, $tasks, $vars);
  11411. }
  11412. }
  11413. private function copyFile($from, $to, $tasks, $vars)
  11414. {
  11415. if (!is_file($from)) {
  11416. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11417. }
  11418. $this->filesystem->ensureDirectoryExists(dirname($to));
  11419. if (0 == count($tasks)) {
  11420. $copied = copy($from, $to);
  11421. } else {
  11422. $content = file_get_contents($from);
  11423. $replacements = array();
  11424. foreach ($tasks as $task) {
  11425. $pattern = $task['from'];
  11426. $varName = $task['to'];
  11427. if (isset($vars[$varName])) {
  11428. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11429. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11430. } else {
  11431. $replacements[$pattern] = $vars[$varName];
  11432. }
  11433. }
  11434. }
  11435. $content = strtr($content, $replacements);
  11436. $copied = file_put_contents($to, $content);
  11437. }
  11438. if (false === $copied) {
  11439. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11440. }
  11441. }
  11442. private function buildCopyActions($source, array $roles, $vars)
  11443. {
  11444. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11445. if (false === $package) {
  11446. throw new \RuntimeException('Package definition file is not valid.');
  11447. }
  11448. $packageSchemaVersion = $package['version'];
  11449. if ('1.0' == $packageSchemaVersion) {
  11450. $children = $package->release->filelist->children();
  11451. $packageName = (string) $package->name;
  11452. $packageVersion = (string) $package->release->version;
  11453. $sourceDir = $packageName . '-' . $packageVersion;
  11454. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11455. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11456. $children = $package->contents->children();
  11457. $packageName = (string) $package->name;
  11458. $packageVersion = (string) $package->version->release;
  11459. $sourceDir = $packageName . '-' . $packageVersion;
  11460. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11461. $namespaces = $package->getNamespaces();
  11462. $package->registerXPathNamespace('ns', $namespaces['']);
  11463. $releaseNodes = $package->xpath('ns:phprelease');
  11464. $this->applyRelease($result, $releaseNodes, $vars);
  11465. } else {
  11466. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11467. }
  11468. return $result;
  11469. }
  11470. private function applyRelease(&$actions, $releaseNodes, $vars)
  11471. {
  11472. foreach ($releaseNodes as $releaseNode) {
  11473. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11474. if ($requiredOs && $vars['os'] != $requiredOs) {
  11475. continue;
  11476. }
  11477. if ($releaseNode->filelist) {
  11478. foreach ($releaseNode->filelist->children() as $action) {
  11479. if ('install' == $action->getName()) {
  11480. $name = (string) $action['name'];
  11481. $as = (string) $action['as'];
  11482. if (isset($actions[$name])) {
  11483. $actions[$name]['to'] = $as;
  11484. }
  11485. } elseif ('ignore' == $action->getName()) {
  11486. $name = (string) $action['name'];
  11487. unset($actions[$name]);
  11488. } else {
  11489. }
  11490. }
  11491. }
  11492. break;
  11493. }
  11494. }
  11495. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11496. {
  11497. $result = array();
  11498. foreach ($children as $child) {
  11499. if ($child->getName() == 'dir') {
  11500. $dirSource = $this->combine($source, (string) $child['name']);
  11501. $dirTarget = $child['baseinstalldir'] ?: $target;
  11502. $dirRole = $child['role'] ?: $role;
  11503. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11504. $result = array_merge($result, $dirFiles);
  11505. } elseif ($child->getName() == 'file') {
  11506. $fileRole = (string) $child['role'] ?: $role;
  11507. if (isset($targetRoles[$fileRole])) {
  11508. $fileName = (string) ($child['name'] ?: $child[0]);
  11509. $fileSource = $this->combine($source, $fileName);
  11510. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11511. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11512. $fileTarget = $packageName . '/' . $fileTarget;
  11513. }
  11514. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11515. }
  11516. }
  11517. }
  11518. return $result;
  11519. }
  11520. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11521. {
  11522. $result = array();
  11523. foreach ($children as $child) {
  11524. if ('dir' == $child->getName()) {
  11525. $dirSource = $this->combine($source, $child['name']);
  11526. $dirTarget = $child['baseinstalldir'] ?: $target;
  11527. $dirRole = $child['role'] ?: $role;
  11528. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11529. $result = array_merge($result, $dirFiles);
  11530. } elseif ('file' == $child->getName()) {
  11531. $fileRole = (string) $child['role'] ?: $role;
  11532. if (isset($targetRoles[$fileRole])) {
  11533. $fileSource = $this->combine($source, (string) $child['name']);
  11534. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11535. $fileTasks = array();
  11536. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11537. if ('replace' == $taskNode->getName()) {
  11538. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11539. }
  11540. }
  11541. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11542. $fileTarget = $packageName . '/' . $fileTarget;
  11543. }
  11544. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11545. }
  11546. }
  11547. }
  11548. return $result;
  11549. }
  11550. private function combine($left, $right)
  11551. {
  11552. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11553. }
  11554. }
  11555. <?php
  11556. namespace Composer\Downloader;
  11557. use Composer\Package\PackageInterface;
  11558. use Composer\Repository\VcsRepository;
  11559. use Composer\Util\Perforce;
  11560. class PerforceDownloader extends VcsDownloader
  11561. {
  11562. protected $perforce;
  11563. public function doDownload(PackageInterface $package, $path, $url)
  11564. {
  11565. $ref = $package->getSourceReference();
  11566. $label = $this->getLabelFromSourceReference($ref);
  11567. $this->io->writeError('Cloning ' . $ref);
  11568. $this->initPerforce($package, $path, $url);
  11569. $this->perforce->setStream($ref);
  11570. $this->perforce->p4Login();
  11571. $this->perforce->writeP4ClientSpec();
  11572. $this->perforce->connectClient();
  11573. $this->perforce->syncCodeBase($label);
  11574. $this->perforce->cleanupClientSpec();
  11575. }
  11576. private function getLabelFromSourceReference($ref)
  11577. {
  11578. $pos = strpos($ref, '@');
  11579. if (false !== $pos) {
  11580. return substr($ref, $pos + 1);
  11581. }
  11582. return null;
  11583. }
  11584. public function initPerforce(PackageInterface $package, $path, $url)
  11585. {
  11586. if (!empty($this->perforce)) {
  11587. $this->perforce->initializePath($path);
  11588. return;
  11589. }
  11590. $repository = $package->getRepository();
  11591. $repoConfig = null;
  11592. if ($repository instanceof VcsRepository) {
  11593. $repoConfig = $this->getRepoConfig($repository);
  11594. }
  11595. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11596. }
  11597. private function getRepoConfig(VcsRepository $repository)
  11598. {
  11599. return $repository->getRepoConfig();
  11600. }
  11601. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11602. {
  11603. $this->doDownload($target, $path, $url);
  11604. }
  11605. public function getLocalChanges(PackageInterface $package, $path)
  11606. {
  11607. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11608. }
  11609. protected function getCommitLogs($fromReference, $toReference, $path)
  11610. {
  11611. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11612. }
  11613. public function setPerforce($perforce)
  11614. {
  11615. $this->perforce = $perforce;
  11616. }
  11617. protected function hasMetadataRepository($path)
  11618. {
  11619. return true;
  11620. }
  11621. }
  11622. <?php
  11623. namespace Composer\Downloader;
  11624. class PharDownloader extends ArchiveDownloader
  11625. {
  11626. protected function extract($file, $path)
  11627. {
  11628. $archive = new \Phar($file);
  11629. $archive->extractTo($path, null, true);
  11630. }
  11631. }
  11632. <?php
  11633. namespace Composer\Downloader;
  11634. use Composer\Config;
  11635. use Composer\Cache;
  11636. use Composer\EventDispatcher\EventDispatcher;
  11637. use Composer\Util\IniHelper;
  11638. use Composer\Util\Platform;
  11639. use Composer\Util\ProcessExecutor;
  11640. use Composer\Util\RemoteFilesystem;
  11641. use Composer\IO\IOInterface;
  11642. use RarArchive;
  11643. class RarDownloader extends ArchiveDownloader
  11644. {
  11645. protected $process;
  11646. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11647. {
  11648. $this->process = $process ?: new ProcessExecutor($io);
  11649. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11650. }
  11651. protected function extract($file, $path)
  11652. {
  11653. $processError = null;
  11654. if (!Platform::isWindows()) {
  11655. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11656. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11657. return;
  11658. }
  11659. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11660. }
  11661. if (!class_exists('RarArchive')) {
  11662. $iniMessage = IniHelper::getMessage();
  11663. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11664. . $iniMessage . "\n" . $processError;
  11665. if (!Platform::isWindows()) {
  11666. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11667. }
  11668. throw new \RuntimeException($error);
  11669. }
  11670. $rarArchive = RarArchive::open($file);
  11671. if (false === $rarArchive) {
  11672. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11673. }
  11674. $entries = $rarArchive->getEntries();
  11675. if (false === $entries) {
  11676. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11677. }
  11678. foreach ($entries as $entry) {
  11679. if (false === $entry->extract($path)) {
  11680. throw new \RuntimeException('Could not extract entry');
  11681. }
  11682. }
  11683. $rarArchive->close();
  11684. }
  11685. }
  11686. <?php
  11687. namespace Composer\Downloader;
  11688. use Composer\Package\PackageInterface;
  11689. use Composer\Util\Svn as SvnUtil;
  11690. use Composer\Repository\VcsRepository;
  11691. use Composer\Util\ProcessExecutor;
  11692. class SvnDownloader extends VcsDownloader
  11693. {
  11694. protected $cacheCredentials = true;
  11695. public function doDownload(PackageInterface $package, $path, $url)
  11696. {
  11697. SvnUtil::cleanEnv();
  11698. $ref = $package->getSourceReference();
  11699. $repo = $package->getRepository();
  11700. if ($repo instanceof VcsRepository) {
  11701. $repoConfig = $repo->getRepoConfig();
  11702. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11703. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11704. }
  11705. }
  11706. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11707. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11708. }
  11709. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11710. {
  11711. SvnUtil::cleanEnv();
  11712. $ref = $target->getSourceReference();
  11713. if (!$this->hasMetadataRepository($path)) {
  11714. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11715. }
  11716. $util = new SvnUtil($url, $this->io, $this->config);
  11717. $flags = "";
  11718. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11719. $flags .= ' --ignore-ancestry';
  11720. }
  11721. $this->io->writeError(" Checking out " . $ref);
  11722. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11723. }
  11724. public function getLocalChanges(PackageInterface $package, $path)
  11725. {
  11726. if (!$this->hasMetadataRepository($path)) {
  11727. return null;
  11728. }
  11729. $this->process->execute('svn status --ignore-externals', $output, $path);
  11730. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11731. }
  11732. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11733. {
  11734. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11735. $util->setCacheCredentials($this->cacheCredentials);
  11736. try {
  11737. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11738. } catch (\RuntimeException $e) {
  11739. throw new \RuntimeException(
  11740. 'Package could not be downloaded, '.$e->getMessage()
  11741. );
  11742. }
  11743. }
  11744. protected function cleanChanges(PackageInterface $package, $path, $update)
  11745. {
  11746. if (!$changes = $this->getLocalChanges($package, $path)) {
  11747. return;
  11748. }
  11749. if (!$this->io->isInteractive()) {
  11750. if (true === $this->config->get('discard-changes')) {
  11751. return $this->discardChanges($path);
  11752. }
  11753. return parent::cleanChanges($package, $path, $update);
  11754. }
  11755. $changes = array_map(function ($elem) {
  11756. return ' '.$elem;
  11757. }, preg_split('{\s*\r?\n\s*}', $changes));
  11758. $countChanges = count($changes);
  11759. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11760. $this->io->writeError(array_slice($changes, 0, 10));
  11761. if ($countChanges > 10) {
  11762. $remaingChanges = $countChanges - 10;
  11763. $this->io->writeError(
  11764. sprintf(
  11765. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11766. $remaingChanges === 1 ? '' : 's'
  11767. )
  11768. );
  11769. }
  11770. while (true) {
  11771. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11772. case 'y':
  11773. $this->discardChanges($path);
  11774. break 2;
  11775. case 'n':
  11776. throw new \RuntimeException('Update aborted');
  11777. case 'v':
  11778. $this->io->writeError($changes);
  11779. break;
  11780. case '?':
  11781. default:
  11782. $this->io->writeError(array(
  11783. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11784. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11785. ' v - view modified files',
  11786. ' ? - print help',
  11787. ));
  11788. break;
  11789. }
  11790. }
  11791. }
  11792. protected function getCommitLogs($fromReference, $toReference, $path)
  11793. {
  11794. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11795. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11796. if (0 !== $this->process->execute($command, $output, $path)) {
  11797. throw new \RuntimeException(
  11798. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11799. );
  11800. }
  11801. $urlPattern = '#<url>(.*)</url>#';
  11802. if (preg_match($urlPattern, $output, $matches)) {
  11803. $baseUrl = $matches[1];
  11804. } else {
  11805. throw new \RuntimeException(
  11806. 'Unable to determine svn url for path '. $path
  11807. );
  11808. }
  11809. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11810. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11811. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11812. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11813. $util->setCacheCredentials($this->cacheCredentials);
  11814. try {
  11815. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11816. } catch (\RuntimeException $e) {
  11817. throw new \RuntimeException(
  11818. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11819. );
  11820. }
  11821. }
  11822. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11823. }
  11824. protected function discardChanges($path)
  11825. {
  11826. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11827. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11828. }
  11829. }
  11830. protected function hasMetadataRepository($path)
  11831. {
  11832. return is_dir($path.'/.svn');
  11833. }
  11834. }
  11835. <?php
  11836. namespace Composer\Downloader;
  11837. class TarDownloader extends ArchiveDownloader
  11838. {
  11839. protected function extract($file, $path)
  11840. {
  11841. $archive = new \PharData($file);
  11842. $archive->extractTo($path, null, true);
  11843. }
  11844. }
  11845. <?php
  11846. namespace Composer\Downloader;
  11847. class TransportException extends \RuntimeException
  11848. {
  11849. protected $headers;
  11850. protected $response;
  11851. protected $statusCode;
  11852. public function setHeaders($headers)
  11853. {
  11854. $this->headers = $headers;
  11855. }
  11856. public function getHeaders()
  11857. {
  11858. return $this->headers;
  11859. }
  11860. public function setResponse($response)
  11861. {
  11862. $this->response = $response;
  11863. }
  11864. public function getResponse()
  11865. {
  11866. return $this->response;
  11867. }
  11868. public function setStatusCode($statusCode)
  11869. {
  11870. $this->statusCode = $statusCode;
  11871. }
  11872. public function getStatusCode()
  11873. {
  11874. return $this->statusCode;
  11875. }
  11876. }
  11877. <?php
  11878. namespace Composer\Downloader;
  11879. use Composer\Package\PackageInterface;
  11880. interface VcsCapableDownloaderInterface
  11881. {
  11882. public function getVcsReference(PackageInterface $package, $path);
  11883. }
  11884. <?php
  11885. namespace Composer\Downloader;
  11886. use Composer\Config;
  11887. use Composer\Package\Dumper\ArrayDumper;
  11888. use Composer\Package\PackageInterface;
  11889. use Composer\Package\Version\VersionGuesser;
  11890. use Composer\Package\Version\VersionParser;
  11891. use Composer\Util\ProcessExecutor;
  11892. use Composer\IO\IOInterface;
  11893. use Composer\Util\Filesystem;
  11894. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11895. {
  11896. protected $io;
  11897. protected $config;
  11898. protected $process;
  11899. protected $filesystem;
  11900. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11901. {
  11902. $this->io = $io;
  11903. $this->config = $config;
  11904. $this->process = $process ?: new ProcessExecutor($io);
  11905. $this->filesystem = $fs ?: new Filesystem($this->process);
  11906. }
  11907. public function getInstallationSource()
  11908. {
  11909. return 'source';
  11910. }
  11911. public function download(PackageInterface $package, $path)
  11912. {
  11913. if (!$package->getSourceReference()) {
  11914. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11915. }
  11916. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11917. $this->filesystem->emptyDirectory($path);
  11918. $urls = $package->getSourceUrls();
  11919. while ($url = array_shift($urls)) {
  11920. try {
  11921. if (Filesystem::isLocalPath($url)) {
  11922. $needle = 'file://';
  11923. $isFileProtocol = false;
  11924. if (0 === strpos($url, $needle)) {
  11925. $url = substr($url, strlen($needle));
  11926. $isFileProtocol = true;
  11927. }
  11928. if (false !== strpos($url, '%')) {
  11929. $url = rawurldecode($url);
  11930. }
  11931. $url = realpath($url);
  11932. if ($isFileProtocol) {
  11933. $url = $needle . $url;
  11934. }
  11935. }
  11936. $this->doDownload($package, $path, $url);
  11937. break;
  11938. } catch (\Exception $e) {
  11939. if ($e instanceof \PHPUnit_Framework_Exception) {
  11940. throw $e;
  11941. }
  11942. if ($this->io->isDebug()) {
  11943. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11944. } elseif (count($urls)) {
  11945. $this->io->writeError(' Failed, trying the next URL');
  11946. }
  11947. if (!count($urls)) {
  11948. throw $e;
  11949. }
  11950. }
  11951. }
  11952. }
  11953. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11954. {
  11955. if (!$target->getSourceReference()) {
  11956. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11957. }
  11958. $name = $target->getName();
  11959. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11960. if ($target->getSourceType() === 'svn') {
  11961. $from = $initial->getSourceReference();
  11962. $to = $target->getSourceReference();
  11963. } else {
  11964. $from = substr($initial->getSourceReference(), 0, 7);
  11965. $to = substr($target->getSourceReference(), 0, 7);
  11966. }
  11967. $name .= ' '.$initial->getPrettyVersion();
  11968. } else {
  11969. $from = $initial->getFullPrettyVersion();
  11970. $to = $target->getFullPrettyVersion();
  11971. }
  11972. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11973. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11974. $this->cleanChanges($initial, $path, true);
  11975. $urls = $target->getSourceUrls();
  11976. $exception = null;
  11977. while ($url = array_shift($urls)) {
  11978. try {
  11979. if (Filesystem::isLocalPath($url)) {
  11980. $url = realpath($url);
  11981. }
  11982. $this->doUpdate($initial, $target, $path, $url);
  11983. $exception = null;
  11984. break;
  11985. } catch (\Exception $exception) {
  11986. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11987. throw $exception;
  11988. }
  11989. if ($this->io->isDebug()) {
  11990. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11991. } elseif (count($urls)) {
  11992. $this->io->writeError(' Failed, trying the next URL');
  11993. }
  11994. }
  11995. }
  11996. $this->reapplyChanges($path);
  11997. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11998. $message = 'Pulling in changes:';
  11999. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12000. if (!trim($logs)) {
  12001. $message = 'Rolling back changes:';
  12002. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12003. }
  12004. if (trim($logs)) {
  12005. $logs = implode("\n", array_map(function ($line) {
  12006. return ' ' . $line;
  12007. }, explode("\n", $logs)));
  12008. $logs = str_replace('<', '\<', $logs);
  12009. $this->io->writeError(' '.$message);
  12010. $this->io->writeError($logs);
  12011. }
  12012. }
  12013. if (!$urls && $exception) {
  12014. throw $exception;
  12015. }
  12016. }
  12017. public function remove(PackageInterface $package, $path)
  12018. {
  12019. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12020. $this->cleanChanges($package, $path, false);
  12021. if (!$this->filesystem->removeDirectory($path)) {
  12022. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12023. }
  12024. }
  12025. public function setOutputProgress($outputProgress)
  12026. {
  12027. return $this;
  12028. }
  12029. public function getVcsReference(PackageInterface $package, $path)
  12030. {
  12031. $parser = new VersionParser;
  12032. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12033. $dumper = new ArrayDumper;
  12034. $packageConfig = $dumper->dump($package);
  12035. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12036. return $packageVersion['commit'];
  12037. }
  12038. }
  12039. protected function cleanChanges(PackageInterface $package, $path, $update)
  12040. {
  12041. if (null !== $this->getLocalChanges($package, $path)) {
  12042. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12043. }
  12044. }
  12045. protected function reapplyChanges($path)
  12046. {
  12047. }
  12048. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12049. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12050. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12051. abstract protected function hasMetadataRepository($path);
  12052. }
  12053. <?php
  12054. namespace Composer\Downloader;
  12055. use Composer\Config;
  12056. use Composer\Cache;
  12057. use Composer\EventDispatcher\EventDispatcher;
  12058. use Composer\Package\PackageInterface;
  12059. use Composer\Util\ProcessExecutor;
  12060. use Composer\Util\RemoteFilesystem;
  12061. use Composer\IO\IOInterface;
  12062. class XzDownloader extends ArchiveDownloader
  12063. {
  12064. protected $process;
  12065. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12066. {
  12067. $this->process = $process ?: new ProcessExecutor($io);
  12068. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12069. }
  12070. protected function extract($file, $path)
  12071. {
  12072. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12073. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12074. return;
  12075. }
  12076. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12077. throw new \RuntimeException($processError);
  12078. }
  12079. protected function getFileName(PackageInterface $package, $path)
  12080. {
  12081. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12082. }
  12083. }
  12084. <?php
  12085. namespace Composer\Downloader;
  12086. use Composer\Config;
  12087. use Composer\Cache;
  12088. use Composer\EventDispatcher\EventDispatcher;
  12089. use Composer\Package\PackageInterface;
  12090. use Composer\Util\IniHelper;
  12091. use Composer\Util\Platform;
  12092. use Composer\Util\ProcessExecutor;
  12093. use Composer\Util\RemoteFilesystem;
  12094. use Composer\IO\IOInterface;
  12095. use Symfony\Component\Process\ExecutableFinder;
  12096. use ZipArchive;
  12097. class ZipDownloader extends ArchiveDownloader
  12098. {
  12099. protected static $hasSystemUnzip;
  12100. private static $hasZipArchive;
  12101. private static $isWindows;
  12102. protected $process;
  12103. private $zipArchiveObject;
  12104. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12105. {
  12106. $this->process = $process ?: new ProcessExecutor($io);
  12107. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12108. }
  12109. public function download(PackageInterface $package, $path, $output = true)
  12110. {
  12111. if (null === self::$hasSystemUnzip) {
  12112. $finder = new ExecutableFinder;
  12113. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12114. }
  12115. if (null === self::$hasZipArchive) {
  12116. self::$hasZipArchive = class_exists('ZipArchive');
  12117. }
  12118. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12119. $iniMessage = IniHelper::getMessage();
  12120. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12121. throw new \RuntimeException($error);
  12122. }
  12123. if (null === self::$isWindows) {
  12124. self::$isWindows = Platform::isWindows();
  12125. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12126. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12127. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  12128. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12129. }
  12130. }
  12131. return parent::download($package, $path, $output);
  12132. }
  12133. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12134. {
  12135. if (!self::$hasZipArchive) {
  12136. $isLastChance = true;
  12137. }
  12138. if (!self::$hasSystemUnzip && !$isLastChance) {
  12139. return $this->extractWithZipArchive($file, $path, true);
  12140. }
  12141. $processError = null;
  12142. $overwrite = $isLastChance ? '-o' : '';
  12143. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12144. try {
  12145. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12146. return true;
  12147. }
  12148. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  12149. } catch (\Exception $e) {
  12150. $processError = $e;
  12151. }
  12152. if ($isLastChance) {
  12153. throw $processError;
  12154. }
  12155. $this->io->writeError(' '.$processError->getMessage());
  12156. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12157. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12158. return $this->extractWithZipArchive($file, $path, true);
  12159. }
  12160. protected function extractWithZipArchive($file, $path, $isLastChance)
  12161. {
  12162. if (!self::$hasSystemUnzip) {
  12163. $isLastChance = true;
  12164. }
  12165. if (!self::$hasZipArchive && !$isLastChance) {
  12166. return $this->extractWithSystemUnzip($file, $path, true);
  12167. }
  12168. $processError = null;
  12169. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12170. try {
  12171. if (true === ($retval = $zipArchive->open($file))) {
  12172. $extractResult = $zipArchive->extractTo($path);
  12173. if (true === $extractResult) {
  12174. $zipArchive->close();
  12175. return true;
  12176. }
  12177. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12178. } else {
  12179. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12180. }
  12181. } catch (\ErrorException $e) {
  12182. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12183. } catch (\Exception $e) {
  12184. $processError = $e;
  12185. }
  12186. if ($isLastChance) {
  12187. throw $processError;
  12188. }
  12189. $this->io->writeError(' '.$processError->getMessage());
  12190. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12191. return $this->extractWithSystemUnzip($file, $path, true);
  12192. }
  12193. public function extract($file, $path)
  12194. {
  12195. if (self::$isWindows) {
  12196. $this->extractWithZipArchive($file, $path, false);
  12197. } else {
  12198. $this->extractWithSystemUnzip($file, $path, false);
  12199. }
  12200. }
  12201. protected function getErrorMessage($retval, $file)
  12202. {
  12203. switch ($retval) {
  12204. case ZipArchive::ER_EXISTS:
  12205. return sprintf("File '%s' already exists.", $file);
  12206. case ZipArchive::ER_INCONS:
  12207. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12208. case ZipArchive::ER_INVAL:
  12209. return sprintf("Invalid argument (%s)", $file);
  12210. case ZipArchive::ER_MEMORY:
  12211. return sprintf("Malloc failure (%s)", $file);
  12212. case ZipArchive::ER_NOENT:
  12213. return sprintf("No such zip file: '%s'", $file);
  12214. case ZipArchive::ER_NOZIP:
  12215. return sprintf("'%s' is not a zip archive.", $file);
  12216. case ZipArchive::ER_OPEN:
  12217. return sprintf("Can't open zip file: %s", $file);
  12218. case ZipArchive::ER_READ:
  12219. return sprintf("Zip read error (%s)", $file);
  12220. case ZipArchive::ER_SEEK:
  12221. return sprintf("Zip seek error (%s)", $file);
  12222. default:
  12223. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12224. }
  12225. }
  12226. }
  12227. <?php
  12228. namespace Composer\EventDispatcher;
  12229. class Event
  12230. {
  12231. protected $name;
  12232. protected $args;
  12233. protected $flags;
  12234. private $propagationStopped = false;
  12235. public function __construct($name, array $args = array(), array $flags = array())
  12236. {
  12237. $this->name = $name;
  12238. $this->args = $args;
  12239. $this->flags = $flags;
  12240. }
  12241. public function getName()
  12242. {
  12243. return $this->name;
  12244. }
  12245. public function getArguments()
  12246. {
  12247. return $this->args;
  12248. }
  12249. public function getFlags()
  12250. {
  12251. return $this->flags;
  12252. }
  12253. public function isPropagationStopped()
  12254. {
  12255. return $this->propagationStopped;
  12256. }
  12257. public function stopPropagation()
  12258. {
  12259. $this->propagationStopped = true;
  12260. }
  12261. }
  12262. <?php
  12263. namespace Composer\EventDispatcher;
  12264. use Composer\DependencyResolver\PolicyInterface;
  12265. use Composer\DependencyResolver\Pool;
  12266. use Composer\DependencyResolver\Request;
  12267. use Composer\Installer\InstallerEvent;
  12268. use Composer\IO\IOInterface;
  12269. use Composer\Composer;
  12270. use Composer\DependencyResolver\Operation\OperationInterface;
  12271. use Composer\Repository\CompositeRepository;
  12272. use Composer\Script;
  12273. use Composer\Installer\PackageEvent;
  12274. use Composer\Installer\BinaryInstaller;
  12275. use Composer\Util\ProcessExecutor;
  12276. use Composer\Script\Event as ScriptEvent;
  12277. use Symfony\Component\Process\PhpExecutableFinder;
  12278. class EventDispatcher
  12279. {
  12280. protected $composer;
  12281. protected $io;
  12282. protected $loader;
  12283. protected $process;
  12284. protected $listeners;
  12285. private $eventStack;
  12286. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12287. {
  12288. $this->composer = $composer;
  12289. $this->io = $io;
  12290. $this->process = $process ?: new ProcessExecutor($io);
  12291. $this->eventStack = array();
  12292. }
  12293. public function dispatch($eventName, Event $event = null)
  12294. {
  12295. if (null === $event) {
  12296. $event = new Event($eventName);
  12297. }
  12298. return $this->doDispatch($event);
  12299. }
  12300. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12301. {
  12302. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12303. }
  12304. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12305. {
  12306. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12307. }
  12308. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12309. {
  12310. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12311. }
  12312. protected function doDispatch(Event $event)
  12313. {
  12314. $pathStr = 'PATH';
  12315. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12316. $pathStr = 'Path';
  12317. }
  12318. $binDir = $this->composer->getConfig()->get('bin-dir');
  12319. if (is_dir($binDir)) {
  12320. $binDir = realpath($binDir);
  12321. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12322. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12323. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12324. }
  12325. }
  12326. $listeners = $this->getListeners($event);
  12327. $this->pushEvent($event);
  12328. $return = 0;
  12329. foreach ($listeners as $callable) {
  12330. if (!is_string($callable)) {
  12331. if (!is_callable($callable)) {
  12332. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12333. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12334. }
  12335. $event = $this->checkListenerExpectedEvent($callable, $event);
  12336. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12337. } elseif ($this->isComposerScript($callable)) {
  12338. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12339. $script = explode(' ', substr($callable, 1));
  12340. $scriptName = $script[0];
  12341. unset($script[0]);
  12342. $args = array_merge($script, $event->getArguments());
  12343. $flags = $event->getFlags();
  12344. if (substr($callable, 0, 10) === '@composer ') {
  12345. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12346. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12347. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12348. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12349. }
  12350. } else {
  12351. if (!$this->getListeners(new Event($scriptName))) {
  12352. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12353. }
  12354. try {
  12355. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12356. $scriptEvent->setOriginatingEvent($event);
  12357. $return = $this->dispatch($scriptName, $scriptEvent);
  12358. } catch (ScriptExecutionException $e) {
  12359. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12360. throw $e;
  12361. }
  12362. }
  12363. } elseif ($this->isPhpScript($callable)) {
  12364. $className = substr($callable, 0, strpos($callable, '::'));
  12365. $methodName = substr($callable, strpos($callable, '::') + 2);
  12366. if (!class_exists($className)) {
  12367. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12368. continue;
  12369. }
  12370. if (!is_callable($callable)) {
  12371. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12372. continue;
  12373. }
  12374. try {
  12375. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12376. } catch (\Exception $e) {
  12377. $message = "Script %s handling the %s event terminated with an exception";
  12378. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12379. throw $e;
  12380. }
  12381. } else {
  12382. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12383. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12384. if ($this->io->isVerbose()) {
  12385. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12386. } else {
  12387. $this->io->writeError(sprintf('> %s', $exec));
  12388. }
  12389. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12390. if ($possibleLocalBinaries) {
  12391. foreach ($possibleLocalBinaries as $localExec) {
  12392. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12393. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12394. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12395. break;
  12396. }
  12397. }
  12398. }
  12399. if (substr($exec, 0, 5) === '@php ') {
  12400. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12401. } else {
  12402. $finder = new PhpExecutableFinder();
  12403. $phpPath = $finder->find(false);
  12404. if ($phpPath) {
  12405. putenv('PHP_BINARY=' . $phpPath);
  12406. }
  12407. }
  12408. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12409. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12410. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12411. }
  12412. }
  12413. if ($event->isPropagationStopped()) {
  12414. break;
  12415. }
  12416. }
  12417. $this->popEvent();
  12418. return $return;
  12419. }
  12420. protected function getPhpExecCommand()
  12421. {
  12422. $finder = new PhpExecutableFinder();
  12423. $phpPath = $finder->find(false);
  12424. if (!$phpPath) {
  12425. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  12426. }
  12427. $phpArgs = $finder->findArguments();
  12428. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  12429. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12430. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12431. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12432. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12433. }
  12434. protected function executeEventPhpScript($className, $methodName, Event $event)
  12435. {
  12436. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12437. if ($this->io->isVerbose()) {
  12438. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12439. } else {
  12440. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12441. }
  12442. return $className::$methodName($event);
  12443. }
  12444. protected function checkListenerExpectedEvent($target, Event $event)
  12445. {
  12446. if (in_array($event->getName(), array(
  12447. 'init',
  12448. 'command',
  12449. 'pre-file-download',
  12450. ), true)) {
  12451. return $event;
  12452. }
  12453. try {
  12454. $reflected = new \ReflectionParameter($target, 0);
  12455. } catch (\Exception $e) {
  12456. return $event;
  12457. }
  12458. $typehint = $reflected->getClass();
  12459. if (!$typehint instanceof \ReflectionClass) {
  12460. return $event;
  12461. }
  12462. $expected = $typehint->getName();
  12463. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12464. 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);
  12465. $event = new \Composer\Script\CommandEvent(
  12466. $event->getName(),
  12467. $event->getComposer(),
  12468. $event->getIO(),
  12469. $event->isDevMode(),
  12470. $event->getArguments()
  12471. );
  12472. }
  12473. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12474. 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);
  12475. $event = new \Composer\Script\PackageEvent(
  12476. $event->getName(),
  12477. $event->getComposer(),
  12478. $event->getIO(),
  12479. $event->isDevMode(),
  12480. $event->getPolicy(),
  12481. $event->getPool(),
  12482. $event->getInstalledRepo(),
  12483. $event->getRequest(),
  12484. $event->getOperations(),
  12485. $event->getOperation()
  12486. );
  12487. }
  12488. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12489. 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);
  12490. $event = new \Composer\Script\Event(
  12491. $event->getName(),
  12492. $event->getComposer(),
  12493. $event->getIO(),
  12494. $event->isDevMode(),
  12495. $event->getArguments(),
  12496. $event->getFlags()
  12497. );
  12498. }
  12499. return $event;
  12500. }
  12501. private function serializeCallback($cb)
  12502. {
  12503. if (is_array($cb) && count($cb) === 2) {
  12504. if (is_object($cb[0])) {
  12505. $cb[0] = get_class($cb[0]);
  12506. }
  12507. if (is_string($cb[0]) && is_string($cb[1])) {
  12508. $cb = implode('::', $cb);
  12509. }
  12510. }
  12511. if (is_string($cb)) {
  12512. return $cb;
  12513. }
  12514. return var_export($cb, true);
  12515. }
  12516. public function addListener($eventName, $listener, $priority = 0)
  12517. {
  12518. $this->listeners[$eventName][$priority][] = $listener;
  12519. }
  12520. public function addSubscriber(EventSubscriberInterface $subscriber)
  12521. {
  12522. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12523. if (is_string($params)) {
  12524. $this->addListener($eventName, array($subscriber, $params));
  12525. } elseif (is_string($params[0])) {
  12526. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12527. } else {
  12528. foreach ($params as $listener) {
  12529. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12530. }
  12531. }
  12532. }
  12533. }
  12534. protected function getListeners(Event $event)
  12535. {
  12536. $scriptListeners = $this->getScriptListeners($event);
  12537. if (!isset($this->listeners[$event->getName()][0])) {
  12538. $this->listeners[$event->getName()][0] = array();
  12539. }
  12540. krsort($this->listeners[$event->getName()]);
  12541. $listeners = $this->listeners;
  12542. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12543. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12544. }
  12545. public function hasEventListeners(Event $event)
  12546. {
  12547. $listeners = $this->getListeners($event);
  12548. return count($listeners) > 0;
  12549. }
  12550. protected function getScriptListeners(Event $event)
  12551. {
  12552. $package = $this->composer->getPackage();
  12553. $scripts = $package->getScripts();
  12554. if (empty($scripts[$event->getName()])) {
  12555. return array();
  12556. }
  12557. if ($this->loader) {
  12558. $this->loader->unregister();
  12559. }
  12560. $generator = $this->composer->getAutoloadGenerator();
  12561. if ($event instanceof ScriptEvent) {
  12562. $generator->setDevMode($event->isDevMode());
  12563. }
  12564. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12565. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12566. $map = $generator->parseAutoloads($packageMap, $package);
  12567. $this->loader = $generator->createLoader($map);
  12568. $this->loader->register();
  12569. return $scripts[$event->getName()];
  12570. }
  12571. protected function isPhpScript($callable)
  12572. {
  12573. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12574. }
  12575. protected function isComposerScript($callable)
  12576. {
  12577. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12578. }
  12579. protected function pushEvent(Event $event)
  12580. {
  12581. $eventName = $event->getName();
  12582. if (in_array($eventName, $this->eventStack)) {
  12583. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12584. }
  12585. return array_push($this->eventStack, $eventName);
  12586. }
  12587. protected function popEvent()
  12588. {
  12589. return array_pop($this->eventStack);
  12590. }
  12591. }
  12592. <?php
  12593. namespace Composer\EventDispatcher;
  12594. interface EventSubscriberInterface
  12595. {
  12596. public static function getSubscribedEvents();
  12597. }
  12598. <?php
  12599. namespace Composer\EventDispatcher;
  12600. class ScriptExecutionException extends \RuntimeException
  12601. {
  12602. }
  12603. <?php
  12604. namespace Composer\Exception;
  12605. class NoSslException extends \RuntimeException
  12606. {
  12607. }
  12608. <?php
  12609. namespace Composer;
  12610. use Composer\Config\JsonConfigSource;
  12611. use Composer\Json\JsonFile;
  12612. use Composer\IO\IOInterface;
  12613. use Composer\Package\Archiver;
  12614. use Composer\Package\Version\VersionGuesser;
  12615. use Composer\Repository\RepositoryManager;
  12616. use Composer\Repository\RepositoryFactory;
  12617. use Composer\Repository\WritableRepositoryInterface;
  12618. use Composer\Util\Filesystem;
  12619. use Composer\Util\Platform;
  12620. use Composer\Util\ProcessExecutor;
  12621. use Composer\Util\RemoteFilesystem;
  12622. use Composer\Util\Silencer;
  12623. use Composer\Plugin\PluginEvents;
  12624. use Composer\EventDispatcher\Event;
  12625. use Seld\JsonLint\DuplicateKeyException;
  12626. use Symfony\Component\Console\Formatter\OutputFormatter;
  12627. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12628. use Symfony\Component\Console\Output\ConsoleOutput;
  12629. use Composer\EventDispatcher\EventDispatcher;
  12630. use Composer\Autoload\AutoloadGenerator;
  12631. use Composer\Package\Version\VersionParser;
  12632. use Composer\Downloader\TransportException;
  12633. use Seld\JsonLint\JsonParser;
  12634. class Factory
  12635. {
  12636. protected static function getHomeDir()
  12637. {
  12638. $home = getenv('COMPOSER_HOME');
  12639. if ($home) {
  12640. return $home;
  12641. }
  12642. if (Platform::isWindows()) {
  12643. if (!getenv('APPDATA')) {
  12644. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12645. }
  12646. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12647. }
  12648. $userDir = self::getUserDir();
  12649. if (is_dir($userDir . '/.composer')) {
  12650. return $userDir . '/.composer';
  12651. }
  12652. if (self::useXdg()) {
  12653. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12654. return $xdgConfig . '/composer';
  12655. }
  12656. return $userDir . '/.composer';
  12657. }
  12658. protected static function getCacheDir($home)
  12659. {
  12660. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12661. if ($cacheDir) {
  12662. return $cacheDir;
  12663. }
  12664. $homeEnv = getenv('COMPOSER_HOME');
  12665. if ($homeEnv) {
  12666. return $homeEnv . '/cache';
  12667. }
  12668. if (Platform::isWindows()) {
  12669. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12670. $cacheDir .= '/Composer';
  12671. } else {
  12672. $cacheDir = $home . '/cache';
  12673. }
  12674. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12675. }
  12676. $userDir = self::getUserDir();
  12677. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12678. return $home . '/cache';
  12679. }
  12680. if (self::useXdg()) {
  12681. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12682. return $xdgCache . '/composer';
  12683. }
  12684. return $home . '/cache';
  12685. }
  12686. protected static function getDataDir($home)
  12687. {
  12688. $homeEnv = getenv('COMPOSER_HOME');
  12689. if ($homeEnv) {
  12690. return $homeEnv;
  12691. }
  12692. if (Platform::isWindows()) {
  12693. return strtr($home, '\\', '/');
  12694. }
  12695. $userDir = self::getUserDir();
  12696. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12697. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12698. return $xdgData . '/composer';
  12699. }
  12700. return $home;
  12701. }
  12702. public static function createConfig(IOInterface $io = null, $cwd = null)
  12703. {
  12704. $cwd = $cwd ?: getcwd();
  12705. $config = new Config(true, $cwd);
  12706. $home = self::getHomeDir();
  12707. $config->merge(array('config' => array(
  12708. 'home' => $home,
  12709. 'cache-dir' => self::getCacheDir($home),
  12710. 'data-dir' => self::getDataDir($home),
  12711. )));
  12712. $file = new JsonFile($config->get('home').'/config.json');
  12713. if ($file->exists()) {
  12714. if ($io && $io->isDebug()) {
  12715. $io->writeError('Loading config file ' . $file->getPath());
  12716. }
  12717. $config->merge($file->read());
  12718. }
  12719. $config->setConfigSource(new JsonConfigSource($file));
  12720. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12721. if ($htaccessProtect) {
  12722. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12723. foreach ($dirs as $dir) {
  12724. if (!file_exists($dir . '/.htaccess')) {
  12725. if (!is_dir($dir)) {
  12726. Silencer::call('mkdir', $dir, 0777, true);
  12727. }
  12728. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12729. }
  12730. }
  12731. }
  12732. $file = new JsonFile($config->get('home').'/auth.json');
  12733. if ($file->exists()) {
  12734. if ($io && $io->isDebug()) {
  12735. $io->writeError('Loading config file ' . $file->getPath());
  12736. }
  12737. $config->merge(array('config' => $file->read()));
  12738. }
  12739. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12740. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12741. $authData = json_decode($composerAuthEnv, true);
  12742. if (null === $authData) {
  12743. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12744. }
  12745. if ($io && $io->isDebug()) {
  12746. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12747. }
  12748. $config->merge(array('config' => $authData));
  12749. }
  12750. return $config;
  12751. }
  12752. public static function getComposerFile()
  12753. {
  12754. return trim(getenv('COMPOSER')) ?: './composer.json';
  12755. }
  12756. public static function createAdditionalStyles()
  12757. {
  12758. return array(
  12759. 'highlight' => new OutputFormatterStyle('red'),
  12760. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12761. );
  12762. }
  12763. public static function createOutput()
  12764. {
  12765. $styles = self::createAdditionalStyles();
  12766. $formatter = new OutputFormatter(false, $styles);
  12767. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12768. }
  12769. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12770. {
  12771. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12772. }
  12773. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12774. {
  12775. $cwd = $cwd ?: getcwd();
  12776. if (null === $localConfig) {
  12777. $localConfig = static::getComposerFile();
  12778. }
  12779. if (is_string($localConfig)) {
  12780. $composerFile = $localConfig;
  12781. $file = new JsonFile($localConfig, null, $io);
  12782. if (!$file->exists()) {
  12783. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12784. $message = 'Composer could not find a composer.json file in '.$cwd;
  12785. } else {
  12786. $message = 'Composer could not find the config file: '.$localConfig;
  12787. }
  12788. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12789. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12790. }
  12791. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12792. $jsonParser = new JsonParser;
  12793. try {
  12794. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12795. } catch (DuplicateKeyException $e) {
  12796. $details = $e->getDetails();
  12797. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12798. }
  12799. $localConfig = $file->read();
  12800. }
  12801. $config = static::createConfig($io, $cwd);
  12802. $config->merge($localConfig);
  12803. if (isset($composerFile)) {
  12804. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12805. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12806. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12807. if ($localAuthFile->exists()) {
  12808. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12809. $config->merge(array('config' => $localAuthFile->read()));
  12810. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12811. }
  12812. }
  12813. $vendorDir = $config->get('vendor-dir');
  12814. $composer = new Composer();
  12815. $composer->setConfig($config);
  12816. if ($fullLoad) {
  12817. $io->loadConfiguration($config);
  12818. }
  12819. $rfs = self::createRemoteFilesystem($io, $config);
  12820. $dispatcher = new EventDispatcher($composer, $io);
  12821. $composer->setEventDispatcher($dispatcher);
  12822. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12823. $composer->setRepositoryManager($rm);
  12824. $this->addLocalRepository($io, $rm, $vendorDir);
  12825. if (!$fullLoad && !isset($localConfig['version'])) {
  12826. $localConfig['version'] = '1.0.0';
  12827. }
  12828. $parser = new VersionParser;
  12829. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12830. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  12831. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12832. $composer->setPackage($package);
  12833. $im = $this->createInstallationManager();
  12834. $composer->setInstallationManager($im);
  12835. if ($fullLoad) {
  12836. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12837. $composer->setDownloadManager($dm);
  12838. $generator = new AutoloadGenerator($dispatcher, $io);
  12839. $composer->setAutoloadGenerator($generator);
  12840. $am = $this->createArchiveManager($config, $dm);
  12841. $composer->setArchiveManager($am);
  12842. }
  12843. $this->createDefaultInstallers($im, $composer, $io);
  12844. if ($fullLoad) {
  12845. $globalComposer = null;
  12846. if (realpath($config->get('home')) !== $cwd) {
  12847. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12848. }
  12849. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12850. $composer->setPluginManager($pm);
  12851. $pm->loadInstalledPlugins();
  12852. }
  12853. if ($fullLoad && isset($composerFile)) {
  12854. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12855. ? substr($composerFile, 0, -4).'lock'
  12856. : $composerFile . '.lock';
  12857. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12858. $composer->setLocker($locker);
  12859. }
  12860. if ($fullLoad) {
  12861. $initEvent = new Event(PluginEvents::INIT);
  12862. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12863. if ($rm->getLocalRepository()) {
  12864. $this->purgePackages($rm->getLocalRepository(), $im);
  12865. }
  12866. }
  12867. return $composer;
  12868. }
  12869. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12870. {
  12871. $factory = new static();
  12872. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12873. }
  12874. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12875. {
  12876. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12877. }
  12878. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12879. {
  12880. $composer = null;
  12881. try {
  12882. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12883. } catch (\Exception $e) {
  12884. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12885. }
  12886. return $composer;
  12887. }
  12888. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12889. {
  12890. $cache = null;
  12891. if ($config->get('cache-files-ttl') > 0) {
  12892. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12893. }
  12894. $dm = new Downloader\DownloadManager($io);
  12895. switch ($preferred = $config->get('preferred-install')) {
  12896. case 'dist':
  12897. $dm->setPreferDist(true);
  12898. break;
  12899. case 'source':
  12900. $dm->setPreferSource(true);
  12901. break;
  12902. case 'auto':
  12903. default:
  12904. break;
  12905. }
  12906. if (is_array($preferred)) {
  12907. $dm->setPreferences($preferred);
  12908. }
  12909. $executor = new ProcessExecutor($io);
  12910. $fs = new Filesystem($executor);
  12911. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12912. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12913. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12914. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12915. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12916. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12917. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12918. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12919. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12920. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12921. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12922. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12923. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12924. return $dm;
  12925. }
  12926. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12927. {
  12928. if (null === $dm) {
  12929. $io = new IO\NullIO();
  12930. $io->loadConfiguration($config);
  12931. $dm = $this->createDownloadManager($io, $config);
  12932. }
  12933. $am = new Archiver\ArchiveManager($dm);
  12934. $am->addArchiver(new Archiver\ZipArchiver);
  12935. $am->addArchiver(new Archiver\PharArchiver);
  12936. return $am;
  12937. }
  12938. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12939. {
  12940. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12941. }
  12942. protected function createInstallationManager()
  12943. {
  12944. return new Installer\InstallationManager();
  12945. }
  12946. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12947. {
  12948. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12949. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12950. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12951. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12952. }
  12953. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12954. {
  12955. foreach ($repo->getPackages() as $package) {
  12956. if (!$im->isPackageInstalled($repo, $package)) {
  12957. $repo->removePackage($package);
  12958. }
  12959. }
  12960. }
  12961. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12962. {
  12963. $factory = new static();
  12964. return $factory->createComposer($io, $config, $disablePlugins);
  12965. }
  12966. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12967. {
  12968. static $warned = false;
  12969. $disableTls = false;
  12970. if ($config && $config->get('disable-tls') === true) {
  12971. if (!$warned) {
  12972. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12973. }
  12974. $warned = true;
  12975. $disableTls = true;
  12976. } elseif (!extension_loaded('openssl')) {
  12977. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12978. . '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.');
  12979. }
  12980. $remoteFilesystemOptions = array();
  12981. if ($disableTls === false) {
  12982. if ($config && $config->get('cafile')) {
  12983. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12984. }
  12985. if ($config && $config->get('capath')) {
  12986. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12987. }
  12988. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12989. }
  12990. try {
  12991. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12992. } catch (TransportException $e) {
  12993. if (false !== strpos($e->getMessage(), 'cafile')) {
  12994. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12995. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12996. if (PHP_VERSION_ID < 50600) {
  12997. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12998. }
  12999. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13000. }
  13001. throw $e;
  13002. }
  13003. return $remoteFilesystem;
  13004. }
  13005. private static function useXdg()
  13006. {
  13007. foreach (array_keys($_SERVER) as $key) {
  13008. if (substr($key, 0, 4) === 'XDG_') {
  13009. return true;
  13010. }
  13011. }
  13012. return false;
  13013. }
  13014. private static function getUserDir()
  13015. {
  13016. $home = getenv('HOME');
  13017. if (!$home) {
  13018. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13019. }
  13020. return rtrim(strtr($home, '\\', '/'), '/');
  13021. }
  13022. }
  13023. <?php
  13024. namespace Composer\IO;
  13025. use Composer\Config;
  13026. use Composer\Util\ProcessExecutor;
  13027. use Psr\Log\LoggerInterface;
  13028. use Psr\Log\LogLevel;
  13029. abstract class BaseIO implements IOInterface, LoggerInterface
  13030. {
  13031. protected $authentications = array();
  13032. public function getAuthentications()
  13033. {
  13034. return $this->authentications;
  13035. }
  13036. public function resetAuthentications()
  13037. {
  13038. $this->authentications = array();
  13039. }
  13040. public function hasAuthentication($repositoryName)
  13041. {
  13042. return isset($this->authentications[$repositoryName]);
  13043. }
  13044. public function getAuthentication($repositoryName)
  13045. {
  13046. if (isset($this->authentications[$repositoryName])) {
  13047. return $this->authentications[$repositoryName];
  13048. }
  13049. return array('username' => null, 'password' => null);
  13050. }
  13051. public function setAuthentication($repositoryName, $username, $password = null)
  13052. {
  13053. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13054. }
  13055. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13056. {
  13057. if ($this->hasAuthentication($repositoryName)) {
  13058. $auth = $this->getAuthentication($repositoryName);
  13059. if ($auth['username'] === $username && $auth['password'] === $password) {
  13060. return;
  13061. }
  13062. $this->writeError(
  13063. sprintf(
  13064. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13065. $repositoryName
  13066. )
  13067. );
  13068. }
  13069. $this->setAuthentication($repositoryName, $username, $password);
  13070. }
  13071. public function loadConfiguration(Config $config)
  13072. {
  13073. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13074. $githubOauth = $config->get('github-oauth') ?: array();
  13075. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13076. $gitlabToken = $config->get('gitlab-token') ?: array();
  13077. $httpBasic = $config->get('http-basic') ?: array();
  13078. foreach ($bitbucketOauth as $domain => $cred) {
  13079. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13080. }
  13081. foreach ($githubOauth as $domain => $token) {
  13082. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13083. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13084. }
  13085. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13086. }
  13087. foreach ($gitlabOauth as $domain => $token) {
  13088. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13089. }
  13090. foreach ($gitlabToken as $domain => $token) {
  13091. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13092. }
  13093. foreach ($httpBasic as $domain => $cred) {
  13094. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13095. }
  13096. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13097. }
  13098. public function emergency($message, array $context = array())
  13099. {
  13100. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13101. }
  13102. public function alert($message, array $context = array())
  13103. {
  13104. return $this->log(LogLevel::ALERT, $message, $context);
  13105. }
  13106. public function critical($message, array $context = array())
  13107. {
  13108. return $this->log(LogLevel::CRITICAL, $message, $context);
  13109. }
  13110. public function error($message, array $context = array())
  13111. {
  13112. return $this->log(LogLevel::ERROR, $message, $context);
  13113. }
  13114. public function warning($message, array $context = array())
  13115. {
  13116. return $this->log(LogLevel::WARNING, $message, $context);
  13117. }
  13118. public function notice($message, array $context = array())
  13119. {
  13120. return $this->log(LogLevel::NOTICE, $message, $context);
  13121. }
  13122. public function info($message, array $context = array())
  13123. {
  13124. return $this->log(LogLevel::INFO, $message, $context);
  13125. }
  13126. public function debug($message, array $context = array())
  13127. {
  13128. return $this->log(LogLevel::DEBUG, $message, $context);
  13129. }
  13130. public function log($level, $message, array $context = array())
  13131. {
  13132. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13133. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13134. } elseif ($level === LogLevel::WARNING) {
  13135. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13136. } elseif ($level === LogLevel::NOTICE) {
  13137. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13138. } elseif ($level === LogLevel::INFO) {
  13139. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13140. } else {
  13141. $this->writeError($message, true, self::DEBUG);
  13142. }
  13143. }
  13144. }
  13145. <?php
  13146. namespace Composer\IO;
  13147. use Symfony\Component\Console\Helper\QuestionHelper;
  13148. use Symfony\Component\Console\Output\StreamOutput;
  13149. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13150. use Symfony\Component\Console\Input\StreamableInputInterface;
  13151. use Symfony\Component\Console\Input\StringInput;
  13152. use Symfony\Component\Console\Helper\HelperSet;
  13153. class BufferIO extends ConsoleIO
  13154. {
  13155. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13156. {
  13157. $input = new StringInput($input);
  13158. $input->setInteractive(false);
  13159. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13160. parent::__construct($input, $output, new HelperSet(array(
  13161. new QuestionHelper(),
  13162. )));
  13163. }
  13164. public function getOutput()
  13165. {
  13166. fseek($this->output->getStream(), 0);
  13167. $output = stream_get_contents($this->output->getStream());
  13168. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13169. $pre = strip_tags($matches[1]);
  13170. if (strlen($pre) === strlen($matches[2])) {
  13171. return '';
  13172. }
  13173. return rtrim($matches[1])."\n";
  13174. }, $output);
  13175. return $output;
  13176. }
  13177. public function setUserInputs(array $inputs)
  13178. {
  13179. if (!$this->input instanceof StreamableInputInterface) {
  13180. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13181. }
  13182. $this->input->setStream($this->createStream($inputs));
  13183. $this->input->setInteractive(true);
  13184. }
  13185. private function createStream(array $inputs)
  13186. {
  13187. $stream = fopen('php://memory', 'r+', false);
  13188. foreach ($inputs as $input) {
  13189. fwrite($stream, $input.PHP_EOL);
  13190. }
  13191. rewind($stream);
  13192. return $stream;
  13193. }
  13194. }
  13195. <?php
  13196. namespace Composer\IO;
  13197. use Composer\Question\StrictConfirmationQuestion;
  13198. use Symfony\Component\Console\Helper\HelperSet;
  13199. use Symfony\Component\Console\Input\InputInterface;
  13200. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13201. use Symfony\Component\Console\Output\OutputInterface;
  13202. use Symfony\Component\Console\Question\ChoiceQuestion;
  13203. use Symfony\Component\Console\Question\Question;
  13204. class ConsoleIO extends BaseIO
  13205. {
  13206. protected $input;
  13207. protected $output;
  13208. protected $helperSet;
  13209. protected $lastMessage;
  13210. protected $lastMessageErr;
  13211. private $startTime;
  13212. private $verbosityMap;
  13213. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13214. {
  13215. $this->input = $input;
  13216. $this->output = $output;
  13217. $this->helperSet = $helperSet;
  13218. $this->verbosityMap = array(
  13219. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13220. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13221. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13222. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13223. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13224. );
  13225. }
  13226. public function enableDebugging($startTime)
  13227. {
  13228. $this->startTime = $startTime;
  13229. }
  13230. public function isInteractive()
  13231. {
  13232. return $this->input->isInteractive();
  13233. }
  13234. public function isDecorated()
  13235. {
  13236. return $this->output->isDecorated();
  13237. }
  13238. public function isVerbose()
  13239. {
  13240. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13241. }
  13242. public function isVeryVerbose()
  13243. {
  13244. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13245. }
  13246. public function isDebug()
  13247. {
  13248. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13249. }
  13250. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13251. {
  13252. $this->doWrite($messages, $newline, false, $verbosity);
  13253. }
  13254. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13255. {
  13256. $this->doWrite($messages, $newline, true, $verbosity);
  13257. }
  13258. private function doWrite($messages, $newline, $stderr, $verbosity)
  13259. {
  13260. $sfVerbosity = $this->verbosityMap[$verbosity];
  13261. if ($sfVerbosity > $this->output->getVerbosity()) {
  13262. return;
  13263. }
  13264. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13265. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13266. }
  13267. if (null !== $this->startTime) {
  13268. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13269. $timeSpent = microtime(true) - $this->startTime;
  13270. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13271. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13272. }, (array) $messages);
  13273. }
  13274. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13275. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13276. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13277. return;
  13278. }
  13279. $this->output->write($messages, $newline, $sfVerbosity);
  13280. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13281. }
  13282. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13283. {
  13284. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13285. }
  13286. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13287. {
  13288. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13289. }
  13290. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13291. {
  13292. $messages = implode($newline ? "\n" : '', (array) $messages);
  13293. if (!isset($size)) {
  13294. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13295. }
  13296. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13297. $this->doWrite($messages, false, $stderr, $verbosity);
  13298. $fill = $size - strlen(strip_tags($messages));
  13299. if ($fill > 0) {
  13300. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13301. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13302. }
  13303. if ($newline) {
  13304. $this->doWrite('', true, $stderr, $verbosity);
  13305. }
  13306. if ($stderr) {
  13307. $this->lastMessageErr = $messages;
  13308. } else {
  13309. $this->lastMessage = $messages;
  13310. }
  13311. }
  13312. public function ask($question, $default = null)
  13313. {
  13314. $helper = $this->helperSet->get('question');
  13315. $question = new Question($question, $default);
  13316. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13317. }
  13318. public function askConfirmation($question, $default = true)
  13319. {
  13320. $helper = $this->helperSet->get('question');
  13321. $question = new StrictConfirmationQuestion($question, $default);
  13322. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13323. }
  13324. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13325. {
  13326. $helper = $this->helperSet->get('question');
  13327. $question = new Question($question, $default);
  13328. $question->setValidator($validator);
  13329. $question->setMaxAttempts($attempts);
  13330. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13331. }
  13332. public function askAndHideAnswer($question)
  13333. {
  13334. $helper = $this->helperSet->get('question');
  13335. $question = new Question($question);
  13336. $question->setHidden(true);
  13337. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13338. }
  13339. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13340. {
  13341. $helper = $this->helperSet->get('question');
  13342. $question = new ChoiceQuestion($question, $choices, $default);
  13343. $question->setMaxAttempts($attempts ?: null);
  13344. $question->setErrorMessage($errorMessage);
  13345. $question->setMultiselect($multiselect);
  13346. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13347. if (!is_array($result)) {
  13348. return (string) array_search($result, $choices, true);
  13349. }
  13350. $results = array();
  13351. foreach ($choices as $index => $choice) {
  13352. if (in_array($choice, $result, true)) {
  13353. $results[] = (string) $index;
  13354. }
  13355. }
  13356. return $results;
  13357. }
  13358. private function getErrorOutput()
  13359. {
  13360. if ($this->output instanceof ConsoleOutputInterface) {
  13361. return $this->output->getErrorOutput();
  13362. }
  13363. return $this->output;
  13364. }
  13365. }
  13366. <?php
  13367. namespace Composer\IO;
  13368. use Composer\Config;
  13369. interface IOInterface
  13370. {
  13371. const QUIET = 1;
  13372. const NORMAL = 2;
  13373. const VERBOSE = 4;
  13374. const VERY_VERBOSE = 8;
  13375. const DEBUG = 16;
  13376. public function isInteractive();
  13377. public function isVerbose();
  13378. public function isVeryVerbose();
  13379. public function isDebug();
  13380. public function isDecorated();
  13381. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13382. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13383. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13384. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13385. public function ask($question, $default = null);
  13386. public function askConfirmation($question, $default = true);
  13387. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13388. public function askAndHideAnswer($question);
  13389. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13390. public function getAuthentications();
  13391. public function hasAuthentication($repositoryName);
  13392. public function getAuthentication($repositoryName);
  13393. public function setAuthentication($repositoryName, $username, $password = null);
  13394. public function loadConfiguration(Config $config);
  13395. }
  13396. <?php
  13397. namespace Composer\IO;
  13398. class NullIO extends BaseIO
  13399. {
  13400. public function isInteractive()
  13401. {
  13402. return false;
  13403. }
  13404. public function isVerbose()
  13405. {
  13406. return false;
  13407. }
  13408. public function isVeryVerbose()
  13409. {
  13410. return false;
  13411. }
  13412. public function isDebug()
  13413. {
  13414. return false;
  13415. }
  13416. public function isDecorated()
  13417. {
  13418. return false;
  13419. }
  13420. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13421. {
  13422. }
  13423. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13424. {
  13425. }
  13426. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13427. {
  13428. }
  13429. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13430. {
  13431. }
  13432. public function ask($question, $default = null)
  13433. {
  13434. return $default;
  13435. }
  13436. public function askConfirmation($question, $default = true)
  13437. {
  13438. return $default;
  13439. }
  13440. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13441. {
  13442. return $default;
  13443. }
  13444. public function askAndHideAnswer($question)
  13445. {
  13446. return null;
  13447. }
  13448. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13449. {
  13450. return $default;
  13451. }
  13452. }
  13453. <?php
  13454. namespace Composer;
  13455. use Composer\Autoload\AutoloadGenerator;
  13456. use Composer\DependencyResolver\DefaultPolicy;
  13457. use Composer\DependencyResolver\Operation\UpdateOperation;
  13458. use Composer\DependencyResolver\Operation\InstallOperation;
  13459. use Composer\DependencyResolver\Operation\UninstallOperation;
  13460. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13461. use Composer\DependencyResolver\Operation\OperationInterface;
  13462. use Composer\DependencyResolver\PolicyInterface;
  13463. use Composer\DependencyResolver\Pool;
  13464. use Composer\DependencyResolver\Request;
  13465. use Composer\DependencyResolver\Rule;
  13466. use Composer\DependencyResolver\Solver;
  13467. use Composer\DependencyResolver\SolverProblemsException;
  13468. use Composer\Downloader\DownloadManager;
  13469. use Composer\EventDispatcher\EventDispatcher;
  13470. use Composer\Installer\InstallationManager;
  13471. use Composer\Installer\InstallerEvents;
  13472. use Composer\Installer\NoopInstaller;
  13473. use Composer\Installer\SuggestedPackagesReporter;
  13474. use Composer\IO\IOInterface;
  13475. use Composer\Package\AliasPackage;
  13476. use Composer\Package\BasePackage;
  13477. use Composer\Package\CompletePackage;
  13478. use Composer\Package\Link;
  13479. use Composer\Package\Loader\ArrayLoader;
  13480. use Composer\Package\Dumper\ArrayDumper;
  13481. use Composer\Semver\Constraint\Constraint;
  13482. use Composer\Package\Locker;
  13483. use Composer\Package\PackageInterface;
  13484. use Composer\Package\RootPackageInterface;
  13485. use Composer\Repository\CompositeRepository;
  13486. use Composer\Repository\InstalledArrayRepository;
  13487. use Composer\Repository\PlatformRepository;
  13488. use Composer\Repository\RepositoryInterface;
  13489. use Composer\Repository\RepositoryManager;
  13490. use Composer\Repository\WritableRepositoryInterface;
  13491. use Composer\Script\ScriptEvents;
  13492. class Installer
  13493. {
  13494. protected $io;
  13495. protected $config;
  13496. protected $package;
  13497. protected $downloadManager;
  13498. protected $repositoryManager;
  13499. protected $locker;
  13500. protected $installationManager;
  13501. protected $eventDispatcher;
  13502. protected $autoloadGenerator;
  13503. protected $preferSource = false;
  13504. protected $preferDist = false;
  13505. protected $optimizeAutoloader = false;
  13506. protected $classMapAuthoritative = false;
  13507. protected $apcuAutoloader = false;
  13508. protected $devMode = false;
  13509. protected $dryRun = false;
  13510. protected $verbose = false;
  13511. protected $update = false;
  13512. protected $dumpAutoloader = true;
  13513. protected $runScripts = true;
  13514. protected $ignorePlatformReqs = false;
  13515. protected $preferStable = false;
  13516. protected $preferLowest = false;
  13517. protected $skipSuggest = false;
  13518. protected $writeLock = true;
  13519. protected $executeOperations = true;
  13520. protected $updateWhitelist = null;
  13521. protected $whitelistDependencies = false;
  13522. protected $whitelistAllDependencies = false;
  13523. protected $suggestedPackagesReporter;
  13524. protected $additionalInstalledRepository;
  13525. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13526. {
  13527. $this->io = $io;
  13528. $this->config = $config;
  13529. $this->package = $package;
  13530. $this->downloadManager = $downloadManager;
  13531. $this->repositoryManager = $repositoryManager;
  13532. $this->locker = $locker;
  13533. $this->installationManager = $installationManager;
  13534. $this->eventDispatcher = $eventDispatcher;
  13535. $this->autoloadGenerator = $autoloadGenerator;
  13536. }
  13537. public function run()
  13538. {
  13539. gc_collect_cycles();
  13540. gc_disable();
  13541. if (!$this->update && !$this->locker->isLocked()) {
  13542. $this->update = true;
  13543. }
  13544. if ($this->dryRun) {
  13545. $this->verbose = true;
  13546. $this->runScripts = false;
  13547. $this->executeOperations = false;
  13548. $this->writeLock = false;
  13549. $this->dumpAutoloader = false;
  13550. $this->installationManager->addInstaller(new NoopInstaller);
  13551. $this->mockLocalRepositories($this->repositoryManager);
  13552. }
  13553. if ($this->runScripts) {
  13554. $devMode = (int) $this->devMode;
  13555. putenv("COMPOSER_DEV_MODE=$devMode");
  13556. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13557. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13558. }
  13559. $this->downloadManager->setPreferSource($this->preferSource);
  13560. $this->downloadManager->setPreferDist($this->preferDist);
  13561. $localRepo = $this->repositoryManager->getLocalRepository();
  13562. if ($this->update) {
  13563. $platformOverrides = $this->config->get('platform') ?: array();
  13564. } else {
  13565. $platformOverrides = $this->locker->getPlatformOverrides();
  13566. }
  13567. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13568. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13569. $aliases = $this->getRootAliases();
  13570. $this->aliasPlatformPackages($platformRepo, $aliases);
  13571. if (!$this->suggestedPackagesReporter) {
  13572. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13573. }
  13574. try {
  13575. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13576. if ($res !== 0) {
  13577. return $res;
  13578. }
  13579. } catch (\Exception $e) {
  13580. if ($this->executeOperations) {
  13581. $this->installationManager->notifyInstalls($this->io);
  13582. }
  13583. throw $e;
  13584. }
  13585. if ($this->executeOperations) {
  13586. $this->installationManager->notifyInstalls($this->io);
  13587. }
  13588. if ($this->devMode && !$this->skipSuggest) {
  13589. $this->suggestedPackagesReporter->output($installedRepo);
  13590. }
  13591. foreach ($localRepo->getPackages() as $package) {
  13592. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13593. continue;
  13594. }
  13595. $replacement = is_string($package->getReplacementPackage())
  13596. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13597. : 'No replacement was suggested';
  13598. $this->io->writeError(
  13599. sprintf(
  13600. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13601. $package->getPrettyName(),
  13602. $replacement
  13603. )
  13604. );
  13605. }
  13606. if ($this->update && $this->writeLock) {
  13607. $localRepo->reload();
  13608. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13609. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13610. $updatedLock = $this->locker->setLockData(
  13611. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13612. $devPackages,
  13613. $platformReqs,
  13614. $platformDevReqs,
  13615. $aliases,
  13616. $this->package->getMinimumStability(),
  13617. $this->package->getStabilityFlags(),
  13618. $this->preferStable || $this->package->getPreferStable(),
  13619. $this->preferLowest,
  13620. $this->config->get('platform') ?: array()
  13621. );
  13622. if ($updatedLock) {
  13623. $this->io->writeError('<info>Writing lock file</info>');
  13624. }
  13625. }
  13626. if ($this->dumpAutoloader) {
  13627. if ($this->optimizeAutoloader) {
  13628. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13629. } else {
  13630. $this->io->writeError('<info>Generating autoload files</info>');
  13631. }
  13632. $this->autoloadGenerator->setDevMode($this->devMode);
  13633. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13634. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13635. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13636. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13637. }
  13638. if ($this->executeOperations) {
  13639. foreach ($localRepo->getPackages() as $package) {
  13640. $this->installationManager->ensureBinariesPresence($package);
  13641. }
  13642. $vendorDir = $this->config->get('vendor-dir');
  13643. if (is_dir($vendorDir)) {
  13644. @touch($vendorDir);
  13645. }
  13646. }
  13647. if ($this->runScripts) {
  13648. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13649. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13650. }
  13651. if (!defined('HHVM_VERSION')) {
  13652. gc_enable();
  13653. }
  13654. return 0;
  13655. }
  13656. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13657. {
  13658. $lockedRepository = null;
  13659. $repositories = null;
  13660. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13661. try {
  13662. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13663. } catch (\RuntimeException $e) {
  13664. if ($this->package->getDevRequires()) {
  13665. throw $e;
  13666. }
  13667. $lockedRepository = $this->locker->getLockedRepository();
  13668. }
  13669. }
  13670. $this->whitelistUpdateDependencies(
  13671. $lockedRepository ?: $localRepo,
  13672. $this->package->getRequires(),
  13673. $this->package->getDevRequires()
  13674. );
  13675. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13676. $policy = $this->createPolicy();
  13677. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13678. $pool->addRepository($installedRepo, $aliases);
  13679. if ($this->update) {
  13680. $repositories = $this->repositoryManager->getRepositories();
  13681. foreach ($repositories as $repository) {
  13682. $pool->addRepository($repository, $aliases);
  13683. }
  13684. }
  13685. if ($lockedRepository) {
  13686. $pool->addRepository($lockedRepository, $aliases);
  13687. }
  13688. $request = $this->createRequest($this->package, $platformRepo);
  13689. if ($this->update) {
  13690. $removedUnstablePackages = array();
  13691. foreach ($localRepo->getPackages() as $package) {
  13692. if (
  13693. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13694. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13695. ) {
  13696. $removedUnstablePackages[$package->getName()] = true;
  13697. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13698. }
  13699. }
  13700. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13701. $request->updateAll();
  13702. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13703. foreach ($links as $link) {
  13704. $request->install($link->getTarget(), $link->getConstraint());
  13705. }
  13706. if ($this->updateWhitelist) {
  13707. $currentPackages = $this->getCurrentPackages($installedRepo);
  13708. $candidates = array();
  13709. foreach ($links as $link) {
  13710. $candidates[$link->getTarget()] = true;
  13711. $rootRequires[$link->getTarget()] = $link;
  13712. }
  13713. foreach ($currentPackages as $package) {
  13714. $candidates[$package->getName()] = true;
  13715. }
  13716. foreach ($candidates as $candidate => $dummy) {
  13717. foreach ($currentPackages as $curPackage) {
  13718. if ($curPackage->getName() === $candidate) {
  13719. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13720. $constraint = new Constraint('=', $curPackage->getVersion());
  13721. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13722. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13723. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13724. $request->install($curPackage->getName(), $constraint);
  13725. }
  13726. break;
  13727. }
  13728. }
  13729. }
  13730. }
  13731. } else {
  13732. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13733. if (!$this->locker->isFresh()) {
  13734. $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);
  13735. }
  13736. foreach ($lockedRepository->getPackages() as $package) {
  13737. $version = $package->getVersion();
  13738. if (isset($aliases[$package->getName()][$version])) {
  13739. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13740. }
  13741. $constraint = new Constraint('=', $version);
  13742. $constraint->setPrettyString($package->getPrettyVersion());
  13743. $request->install($package->getName(), $constraint);
  13744. }
  13745. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13746. $request->install($link->getTarget(), $link->getConstraint());
  13747. }
  13748. }
  13749. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13750. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13751. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13752. try {
  13753. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13754. $ruleSetSize = $solver->getRuleSetSize();
  13755. $solver = null;
  13756. } catch (SolverProblemsException $e) {
  13757. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13758. $this->io->writeError($e->getMessage());
  13759. if ($this->update && !$this->devMode) {
  13760. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13761. }
  13762. return array(max(1, $e->getCode()), array());
  13763. }
  13764. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13765. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13766. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13767. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13768. if (!$operations) {
  13769. $this->io->writeError('Nothing to install or update');
  13770. }
  13771. $operations = $this->movePluginsToFront($operations);
  13772. $operations = $this->moveUninstallsToFront($operations);
  13773. if ($this->update) {
  13774. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13775. if (!$this->devMode) {
  13776. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13777. }
  13778. } else {
  13779. $devPackages = null;
  13780. }
  13781. if ($operations) {
  13782. $installs = $updates = $uninstalls = array();
  13783. foreach ($operations as $operation) {
  13784. if ($operation instanceof InstallOperation) {
  13785. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13786. } elseif ($operation instanceof UpdateOperation) {
  13787. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13788. } elseif ($operation instanceof UninstallOperation) {
  13789. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13790. }
  13791. }
  13792. $this->io->writeError(sprintf(
  13793. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13794. count($installs),
  13795. 1 === count($installs) ? '' : 's',
  13796. count($updates),
  13797. 1 === count($updates) ? '' : 's',
  13798. count($uninstalls),
  13799. 1 === count($uninstalls) ? '' : 's'
  13800. ));
  13801. if ($installs) {
  13802. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13803. }
  13804. if ($updates) {
  13805. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13806. }
  13807. if ($uninstalls) {
  13808. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13809. }
  13810. }
  13811. foreach ($operations as $operation) {
  13812. $jobType = $operation->getJobType();
  13813. if ('install' === $jobType) {
  13814. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13815. }
  13816. if ($this->update) {
  13817. $package = null;
  13818. if ('update' === $jobType) {
  13819. $package = $operation->getTargetPackage();
  13820. } elseif ('install' === $jobType) {
  13821. $package = $operation->getPackage();
  13822. }
  13823. if ($package && $package->isDev()) {
  13824. $references = $this->package->getReferences();
  13825. if (isset($references[$package->getName()])) {
  13826. $this->updateInstallReferences($package, $references[$package->getName()]);
  13827. }
  13828. }
  13829. if ('update' === $jobType) {
  13830. $targetPackage = $operation->getTargetPackage();
  13831. if ($targetPackage->isDev()) {
  13832. $initialPackage = $operation->getInitialPackage();
  13833. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13834. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13835. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13836. ) {
  13837. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13838. $this->io->writeError('', true, IOInterface::DEBUG);
  13839. continue;
  13840. }
  13841. }
  13842. }
  13843. }
  13844. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13845. if (defined($event) && $this->runScripts) {
  13846. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13847. }
  13848. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13849. $this->io->writeError(' - ' . $operation);
  13850. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13851. $this->io->writeError(' - ' . $operation);
  13852. }
  13853. $this->installationManager->execute($localRepo, $operation);
  13854. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13855. $reason = $operation->getReason();
  13856. if ($reason instanceof Rule) {
  13857. switch ($reason->getReason()) {
  13858. case Rule::RULE_JOB_INSTALL:
  13859. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13860. $this->io->writeError('');
  13861. break;
  13862. case Rule::RULE_PACKAGE_REQUIRES:
  13863. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13864. $this->io->writeError('');
  13865. break;
  13866. }
  13867. }
  13868. }
  13869. if ($this->executeOperations || $this->writeLock) {
  13870. $localRepo->write();
  13871. }
  13872. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13873. if (defined($event) && $this->runScripts) {
  13874. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13875. }
  13876. }
  13877. if ($this->executeOperations) {
  13878. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13879. $localRepo->write();
  13880. }
  13881. return array(0, $devPackages);
  13882. }
  13883. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13884. {
  13885. if (!$this->package->getDevRequires()) {
  13886. return array();
  13887. }
  13888. $tempLocalRepo = clone $localRepo;
  13889. foreach ($operations as $operation) {
  13890. switch ($operation->getJobType()) {
  13891. case 'install':
  13892. case 'markAliasInstalled':
  13893. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13894. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13895. }
  13896. break;
  13897. case 'uninstall':
  13898. case 'markAliasUninstalled':
  13899. $tempLocalRepo->removePackage($operation->getPackage());
  13900. break;
  13901. case 'update':
  13902. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13903. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13904. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13905. }
  13906. break;
  13907. default:
  13908. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13909. }
  13910. }
  13911. $localRepo = new InstalledArrayRepository(array());
  13912. $loader = new ArrayLoader(null, true);
  13913. $dumper = new ArrayDumper();
  13914. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13915. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13916. }
  13917. unset($tempLocalRepo, $loader, $dumper);
  13918. $policy = $this->createPolicy();
  13919. $pool = $this->createPool();
  13920. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13921. $pool->addRepository($installedRepo, $aliases);
  13922. $request = $this->createRequest($this->package, $platformRepo);
  13923. $request->updateAll();
  13924. foreach ($this->package->getRequires() as $link) {
  13925. $request->install($link->getTarget(), $link->getConstraint());
  13926. }
  13927. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13928. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13929. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13930. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13931. $devPackages = array();
  13932. foreach ($ops as $op) {
  13933. if ($op->getJobType() === 'uninstall') {
  13934. $devPackages[] = $op->getPackage();
  13935. }
  13936. }
  13937. return $devPackages;
  13938. }
  13939. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13940. {
  13941. $finalOps = array();
  13942. $packagesToSkip = array();
  13943. foreach ($devPackages as $pkg) {
  13944. $packagesToSkip[$pkg->getName()] = true;
  13945. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13946. if ($installedDevPkg instanceof AliasPackage) {
  13947. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13948. $installedDevPkg = $installedDevPkg->getAliasOf();
  13949. }
  13950. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13951. }
  13952. }
  13953. foreach ($operations as $op) {
  13954. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13955. if (isset($packagesToSkip[$package->getName()])) {
  13956. continue;
  13957. }
  13958. $finalOps[] = $op;
  13959. }
  13960. return $finalOps;
  13961. }
  13962. private function movePluginsToFront(array $operations)
  13963. {
  13964. $pluginsNoDeps = array();
  13965. $pluginsWithDeps = array();
  13966. $pluginRequires = array();
  13967. foreach (array_reverse($operations, true) as $idx => $op) {
  13968. if ($op instanceof InstallOperation) {
  13969. $package = $op->getPackage();
  13970. } elseif ($op instanceof UpdateOperation) {
  13971. $package = $op->getTargetPackage();
  13972. } else {
  13973. continue;
  13974. }
  13975. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13976. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13977. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13978. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13979. });
  13980. if ($isPlugin && !count($requires)) {
  13981. array_unshift($pluginsNoDeps, $op);
  13982. } else {
  13983. $pluginRequires = array_merge($pluginRequires, $requires);
  13984. array_unshift($pluginsWithDeps, $op);
  13985. }
  13986. unset($operations[$idx]);
  13987. }
  13988. }
  13989. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13990. }
  13991. private function moveUninstallsToFront(array $operations)
  13992. {
  13993. $uninstOps = array();
  13994. foreach ($operations as $idx => $op) {
  13995. if ($op instanceof UninstallOperation) {
  13996. $uninstOps[] = $op;
  13997. unset($operations[$idx]);
  13998. }
  13999. }
  14000. return array_merge($uninstOps, $operations);
  14001. }
  14002. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14003. {
  14004. $installedRootPackage = clone $this->package;
  14005. $installedRootPackage->setRequires(array());
  14006. $installedRootPackage->setDevRequires(array());
  14007. $repos = array(
  14008. $localRepo,
  14009. new InstalledArrayRepository(array($installedRootPackage)),
  14010. $platformRepo,
  14011. );
  14012. $installedRepo = new CompositeRepository($repos);
  14013. if ($this->additionalInstalledRepository) {
  14014. $installedRepo->addRepository($this->additionalInstalledRepository);
  14015. }
  14016. return $installedRepo;
  14017. }
  14018. private function createPool(RepositoryInterface $lockedRepository = null)
  14019. {
  14020. if ($this->update) {
  14021. $minimumStability = $this->package->getMinimumStability();
  14022. $stabilityFlags = $this->package->getStabilityFlags();
  14023. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14024. } else {
  14025. $minimumStability = $this->locker->getMinimumStability();
  14026. $stabilityFlags = $this->locker->getStabilityFlags();
  14027. $requires = array();
  14028. foreach ($lockedRepository->getPackages() as $package) {
  14029. $constraint = new Constraint('=', $package->getVersion());
  14030. $constraint->setPrettyString($package->getPrettyVersion());
  14031. $requires[$package->getName()] = $constraint;
  14032. }
  14033. }
  14034. $rootConstraints = array();
  14035. foreach ($requires as $req => $constraint) {
  14036. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14037. continue;
  14038. }
  14039. if ($constraint instanceof Link) {
  14040. $rootConstraints[$req] = $constraint->getConstraint();
  14041. } else {
  14042. $rootConstraints[$req] = $constraint;
  14043. }
  14044. }
  14045. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14046. }
  14047. private function createPolicy()
  14048. {
  14049. $preferStable = null;
  14050. $preferLowest = null;
  14051. if (!$this->update) {
  14052. $preferStable = $this->locker->getPreferStable();
  14053. $preferLowest = $this->locker->getPreferLowest();
  14054. }
  14055. if (null === $preferStable) {
  14056. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14057. }
  14058. if (null === $preferLowest) {
  14059. $preferLowest = $this->preferLowest;
  14060. }
  14061. return new DefaultPolicy($preferStable, $preferLowest);
  14062. }
  14063. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14064. {
  14065. $request = new Request();
  14066. $constraint = new Constraint('=', $rootPackage->getVersion());
  14067. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14068. $request->install($rootPackage->getName(), $constraint);
  14069. $fixedPackages = $platformRepo->getPackages();
  14070. if ($this->additionalInstalledRepository) {
  14071. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14072. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14073. }
  14074. $provided = $rootPackage->getProvides();
  14075. foreach ($fixedPackages as $package) {
  14076. $constraint = new Constraint('=', $package->getVersion());
  14077. $constraint->setPrettyString($package->getPrettyVersion());
  14078. if ($package->getRepository() !== $platformRepo
  14079. || !isset($provided[$package->getName()])
  14080. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14081. ) {
  14082. $request->fix($package->getName(), $constraint);
  14083. }
  14084. }
  14085. return $request;
  14086. }
  14087. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14088. {
  14089. if ($task === 'force-updates' && null === $operations) {
  14090. throw new \InvalidArgumentException('Missing operations argument');
  14091. }
  14092. if ($task === 'force-links') {
  14093. $operations = array();
  14094. }
  14095. if ($this->update && $this->updateWhitelist) {
  14096. $currentPackages = $this->getCurrentPackages($installedRepo);
  14097. }
  14098. foreach ($localRepo->getCanonicalPackages() as $package) {
  14099. if (!$package->isDev()) {
  14100. continue;
  14101. }
  14102. foreach ($operations as $operation) {
  14103. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14104. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14105. ) {
  14106. continue 2;
  14107. }
  14108. }
  14109. if ($this->update) {
  14110. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14111. foreach ($currentPackages as $curPackage) {
  14112. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14113. if ($task === 'force-links') {
  14114. $package->setRequires($curPackage->getRequires());
  14115. $package->setConflicts($curPackage->getConflicts());
  14116. $package->setProvides($curPackage->getProvides());
  14117. $package->setReplaces($curPackage->getReplaces());
  14118. } elseif ($task === 'force-updates') {
  14119. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14120. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14121. ) {
  14122. $operations[] = new UpdateOperation($package, $curPackage);
  14123. }
  14124. }
  14125. break;
  14126. }
  14127. }
  14128. continue;
  14129. }
  14130. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14131. foreach ($matches as $index => $match) {
  14132. if (!in_array($match->getRepository(), $repositories, true)) {
  14133. unset($matches[$index]);
  14134. continue;
  14135. }
  14136. if ($match->getName() !== $package->getName()) {
  14137. unset($matches[$index]);
  14138. continue;
  14139. }
  14140. $matches[$index] = $match->getId();
  14141. }
  14142. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14143. $newPackage = $pool->literalToPackage($matches[0]);
  14144. if ($task === 'force-links' && $newPackage) {
  14145. $package->setRequires($newPackage->getRequires());
  14146. $package->setConflicts($newPackage->getConflicts());
  14147. $package->setProvides($newPackage->getProvides());
  14148. $package->setReplaces($newPackage->getReplaces());
  14149. }
  14150. if (
  14151. $task === 'force-updates'
  14152. && $newPackage
  14153. && (
  14154. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14155. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14156. )
  14157. ) {
  14158. $operations[] = new UpdateOperation($package, $newPackage);
  14159. continue;
  14160. }
  14161. }
  14162. if ($task === 'force-updates') {
  14163. $references = $this->package->getReferences();
  14164. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14165. $operations[] = new UpdateOperation($package, clone $package);
  14166. }
  14167. }
  14168. } else {
  14169. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14170. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14171. if ($task === 'force-links') {
  14172. $package->setRequires($lockedPackage->getRequires());
  14173. $package->setConflicts($lockedPackage->getConflicts());
  14174. $package->setProvides($lockedPackage->getProvides());
  14175. $package->setReplaces($lockedPackage->getReplaces());
  14176. } elseif ($task === 'force-updates') {
  14177. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14178. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14179. ) {
  14180. $operations[] = new UpdateOperation($package, $lockedPackage);
  14181. }
  14182. }
  14183. break;
  14184. }
  14185. }
  14186. }
  14187. }
  14188. return $operations;
  14189. }
  14190. private function getCurrentPackages($installedRepo)
  14191. {
  14192. if ($this->locker->isLocked()) {
  14193. try {
  14194. return $this->locker->getLockedRepository(true)->getPackages();
  14195. } catch (\RuntimeException $e) {
  14196. return $this->locker->getLockedRepository()->getPackages();
  14197. }
  14198. }
  14199. return $installedRepo->getPackages();
  14200. }
  14201. private function getRootAliases()
  14202. {
  14203. if ($this->update) {
  14204. $aliases = $this->package->getAliases();
  14205. } else {
  14206. $aliases = $this->locker->getAliases();
  14207. }
  14208. $normalizedAliases = array();
  14209. foreach ($aliases as $alias) {
  14210. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14211. 'alias' => $alias['alias'],
  14212. 'alias_normalized' => $alias['alias_normalized'],
  14213. );
  14214. }
  14215. return $normalizedAliases;
  14216. }
  14217. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14218. {
  14219. if (!$this->update) {
  14220. return;
  14221. }
  14222. $rootRefs = $this->package->getReferences();
  14223. foreach ($localRepo->getCanonicalPackages() as $package) {
  14224. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14225. foreach ($matches as $index => $match) {
  14226. if (!in_array($match->getRepository(), $repositories, true)) {
  14227. unset($matches[$index]);
  14228. continue;
  14229. }
  14230. if ($match->getName() !== $package->getName()) {
  14231. unset($matches[$index]);
  14232. continue;
  14233. }
  14234. $matches[$index] = $match->getId();
  14235. }
  14236. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14237. $newPackage = $pool->literalToPackage($matches[0]);
  14238. $sourceUrl = $package->getSourceUrl();
  14239. $newSourceUrl = $newPackage->getSourceUrl();
  14240. $newReference = $newPackage->getSourceReference();
  14241. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14242. $newReference = $rootRefs[$package->getName()];
  14243. }
  14244. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14245. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14246. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14247. }
  14248. $package->setDistMirrors($newPackage->getDistMirrors());
  14249. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14250. $package->setTransportOptions($newPackage->getTransportOptions());
  14251. }
  14252. }
  14253. }
  14254. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14255. {
  14256. $oldSourceRef = $package->getSourceReference();
  14257. if ($package->getSourceUrl() !== $sourceUrl) {
  14258. $package->setSourceType($sourceType);
  14259. $package->setSourceUrl($sourceUrl);
  14260. $package->setSourceReference($sourceReference);
  14261. }
  14262. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14263. $package->setDistUrl($distUrl);
  14264. $package->setDistType($distType);
  14265. $package->setDistSha1Checksum($distShaSum);
  14266. $this->updateInstallReferences($package, $sourceReference);
  14267. }
  14268. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14269. $this->updateInstallReferences($package, $oldSourceRef);
  14270. }
  14271. }
  14272. private function updateInstallReferences(PackageInterface $package, $reference)
  14273. {
  14274. if (!$reference) {
  14275. return;
  14276. }
  14277. $package->setSourceReference($reference);
  14278. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14279. $package->setDistReference($reference);
  14280. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14281. } elseif ($package->getDistReference()) {
  14282. $package->setDistReference($reference);
  14283. }
  14284. }
  14285. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14286. {
  14287. foreach ($aliases as $package => $versions) {
  14288. foreach ($versions as $version => $alias) {
  14289. $packages = $platformRepo->findPackages($package, $version);
  14290. foreach ($packages as $package) {
  14291. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14292. $aliasPackage->setRootPackageAlias(true);
  14293. $platformRepo->addPackage($aliasPackage);
  14294. }
  14295. }
  14296. }
  14297. }
  14298. private function isUpdateable(PackageInterface $package)
  14299. {
  14300. if (!$this->updateWhitelist) {
  14301. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  14302. }
  14303. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  14304. $patternRegexp = BasePackage::packageNameToRegexp($whiteListedPattern);
  14305. if (preg_match($patternRegexp, $package->getName())) {
  14306. return true;
  14307. }
  14308. }
  14309. return false;
  14310. }
  14311. private function extractPlatformRequirements($links)
  14312. {
  14313. $platformReqs = array();
  14314. foreach ($links as $link) {
  14315. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14316. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14317. }
  14318. }
  14319. return $platformReqs;
  14320. }
  14321. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14322. {
  14323. if (!$this->updateWhitelist) {
  14324. return;
  14325. }
  14326. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14327. $skipPackages = array();
  14328. if (!$this->whitelistAllDependencies) {
  14329. foreach ($rootRequires as $require) {
  14330. $skipPackages[$require->getTarget()] = true;
  14331. }
  14332. }
  14333. $pool = new Pool('dev');
  14334. $pool->addRepository($localOrLockRepo);
  14335. $seen = array();
  14336. $rootRequiredPackageNames = array_keys($rootRequires);
  14337. foreach ($this->updateWhitelist as $packageName => $void) {
  14338. $packageQueue = new \SplQueue;
  14339. $nameMatchesRequiredPackage = false;
  14340. $depPackages = $pool->whatProvides($packageName);
  14341. $matchesByPattern = array();
  14342. if (empty($depPackages)) {
  14343. $whitelistPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  14344. foreach ($localOrLockRepo->search($whitelistPatternSearchRegexp) as $installedPackage) {
  14345. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  14346. }
  14347. $whitelistPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  14348. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14349. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14350. $nameMatchesRequiredPackage = true;
  14351. break;
  14352. }
  14353. }
  14354. }
  14355. if (!empty($matchesByPattern)) {
  14356. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  14357. }
  14358. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14359. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14360. }
  14361. foreach ($depPackages as $depPackage) {
  14362. $packageQueue->enqueue($depPackage);
  14363. }
  14364. while (!$packageQueue->isEmpty()) {
  14365. $package = $packageQueue->dequeue();
  14366. if (isset($seen[$package->getId()])) {
  14367. continue;
  14368. }
  14369. $seen[$package->getId()] = true;
  14370. $this->updateWhitelist[$package->getName()] = true;
  14371. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14372. continue;
  14373. }
  14374. $requires = $package->getRequires();
  14375. foreach ($requires as $require) {
  14376. $requirePackages = $pool->whatProvides($require->getTarget());
  14377. foreach ($requirePackages as $requirePackage) {
  14378. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14379. continue;
  14380. }
  14381. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  14382. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14383. continue;
  14384. }
  14385. $packageQueue->enqueue($requirePackage);
  14386. }
  14387. }
  14388. }
  14389. }
  14390. }
  14391. private function mockLocalRepositories(RepositoryManager $rm)
  14392. {
  14393. $packages = array();
  14394. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14395. $packages[(string) $package] = clone $package;
  14396. }
  14397. foreach ($packages as $key => $package) {
  14398. if ($package instanceof AliasPackage) {
  14399. $alias = (string) $package->getAliasOf();
  14400. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14401. }
  14402. }
  14403. $rm->setLocalRepository(
  14404. new InstalledArrayRepository($packages)
  14405. );
  14406. }
  14407. public static function create(IOInterface $io, Composer $composer)
  14408. {
  14409. return new static(
  14410. $io,
  14411. $composer->getConfig(),
  14412. $composer->getPackage(),
  14413. $composer->getDownloadManager(),
  14414. $composer->getRepositoryManager(),
  14415. $composer->getLocker(),
  14416. $composer->getInstallationManager(),
  14417. $composer->getEventDispatcher(),
  14418. $composer->getAutoloadGenerator()
  14419. );
  14420. }
  14421. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14422. {
  14423. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14424. return $this;
  14425. }
  14426. public function setDryRun($dryRun = true)
  14427. {
  14428. $this->dryRun = (bool) $dryRun;
  14429. return $this;
  14430. }
  14431. public function isDryRun()
  14432. {
  14433. return $this->dryRun;
  14434. }
  14435. public function setPreferSource($preferSource = true)
  14436. {
  14437. $this->preferSource = (bool) $preferSource;
  14438. return $this;
  14439. }
  14440. public function setPreferDist($preferDist = true)
  14441. {
  14442. $this->preferDist = (bool) $preferDist;
  14443. return $this;
  14444. }
  14445. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14446. {
  14447. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14448. if (!$this->optimizeAutoloader) {
  14449. $this->setClassMapAuthoritative(false);
  14450. }
  14451. return $this;
  14452. }
  14453. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14454. {
  14455. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14456. if ($this->classMapAuthoritative) {
  14457. $this->setOptimizeAutoloader(true);
  14458. }
  14459. return $this;
  14460. }
  14461. public function setApcuAutoloader($apcuAutoloader = false)
  14462. {
  14463. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14464. return $this;
  14465. }
  14466. public function setUpdate($update = true)
  14467. {
  14468. $this->update = (bool) $update;
  14469. return $this;
  14470. }
  14471. public function setDevMode($devMode = true)
  14472. {
  14473. $this->devMode = (bool) $devMode;
  14474. return $this;
  14475. }
  14476. public function setDumpAutoloader($dumpAutoloader = true)
  14477. {
  14478. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14479. return $this;
  14480. }
  14481. public function setRunScripts($runScripts = true)
  14482. {
  14483. $this->runScripts = (bool) $runScripts;
  14484. return $this;
  14485. }
  14486. public function setConfig(Config $config)
  14487. {
  14488. $this->config = $config;
  14489. return $this;
  14490. }
  14491. public function setVerbose($verbose = true)
  14492. {
  14493. $this->verbose = (bool) $verbose;
  14494. return $this;
  14495. }
  14496. public function isVerbose()
  14497. {
  14498. return $this->verbose;
  14499. }
  14500. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14501. {
  14502. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14503. return $this;
  14504. }
  14505. public function setUpdateWhitelist(array $packages)
  14506. {
  14507. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14508. return $this;
  14509. }
  14510. public function setWhitelistDependencies($updateDependencies = true)
  14511. {
  14512. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14513. }
  14514. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14515. {
  14516. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14517. return $this;
  14518. }
  14519. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14520. {
  14521. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14522. return $this;
  14523. }
  14524. public function setPreferStable($preferStable = true)
  14525. {
  14526. $this->preferStable = (bool) $preferStable;
  14527. return $this;
  14528. }
  14529. public function setPreferLowest($preferLowest = true)
  14530. {
  14531. $this->preferLowest = (bool) $preferLowest;
  14532. return $this;
  14533. }
  14534. public function setWriteLock($writeLock = true)
  14535. {
  14536. $this->writeLock = (bool) $writeLock;
  14537. return $this;
  14538. }
  14539. public function setExecuteOperations($executeOperations = true)
  14540. {
  14541. $this->executeOperations = (bool) $executeOperations;
  14542. return $this;
  14543. }
  14544. public function setSkipSuggest($skipSuggest = true)
  14545. {
  14546. $this->skipSuggest = (bool) $skipSuggest;
  14547. return $this;
  14548. }
  14549. public function disablePlugins()
  14550. {
  14551. $this->installationManager->disablePlugins();
  14552. return $this;
  14553. }
  14554. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14555. {
  14556. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14557. return $this;
  14558. }
  14559. }
  14560. <?php
  14561. namespace Composer\Installer;
  14562. use Composer\IO\IOInterface;
  14563. use Composer\Package\PackageInterface;
  14564. use Composer\Util\Filesystem;
  14565. use Composer\Util\Platform;
  14566. use Composer\Util\ProcessExecutor;
  14567. use Composer\Util\Silencer;
  14568. class BinaryInstaller
  14569. {
  14570. protected $binDir;
  14571. protected $binCompat;
  14572. protected $io;
  14573. protected $filesystem;
  14574. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14575. {
  14576. $this->binDir = $binDir;
  14577. $this->binCompat = $binCompat;
  14578. $this->io = $io;
  14579. $this->filesystem = $filesystem ?: new Filesystem();
  14580. }
  14581. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14582. {
  14583. $binaries = $this->getBinaries($package);
  14584. if (!$binaries) {
  14585. return;
  14586. }
  14587. foreach ($binaries as $bin) {
  14588. $binPath = $installPath.'/'.$bin;
  14589. if (!file_exists($binPath)) {
  14590. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14591. continue;
  14592. }
  14593. $binPath = realpath($binPath);
  14594. $this->initializeBinDir();
  14595. $link = $this->binDir.'/'.basename($bin);
  14596. if (file_exists($link)) {
  14597. if (is_link($link)) {
  14598. Silencer::call('chmod', $link, 0777 & ~umask());
  14599. }
  14600. if ($warnOnOverwrite) {
  14601. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14602. }
  14603. continue;
  14604. }
  14605. if ($this->binCompat === "auto") {
  14606. if (Platform::isWindows()) {
  14607. $this->installFullBinaries($binPath, $link, $bin, $package);
  14608. } else {
  14609. $this->installSymlinkBinaries($binPath, $link);
  14610. }
  14611. } elseif ($this->binCompat === "full") {
  14612. $this->installFullBinaries($binPath, $link, $bin, $package);
  14613. }
  14614. Silencer::call('chmod', $link, 0777 & ~umask());
  14615. }
  14616. }
  14617. public function removeBinaries(PackageInterface $package)
  14618. {
  14619. $this->initializeBinDir();
  14620. $binaries = $this->getBinaries($package);
  14621. if (!$binaries) {
  14622. return;
  14623. }
  14624. foreach ($binaries as $bin) {
  14625. $link = $this->binDir.'/'.basename($bin);
  14626. if (is_link($link) || file_exists($link)) {
  14627. $this->filesystem->unlink($link);
  14628. }
  14629. if (file_exists($link.'.bat')) {
  14630. $this->filesystem->unlink($link.'.bat');
  14631. }
  14632. }
  14633. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14634. Silencer::call('rmdir', $this->binDir);
  14635. }
  14636. }
  14637. public static function determineBinaryCaller($bin)
  14638. {
  14639. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14640. return 'call';
  14641. }
  14642. $handle = fopen($bin, 'r');
  14643. $line = fgets($handle);
  14644. fclose($handle);
  14645. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14646. return trim($match[1]);
  14647. }
  14648. return 'php';
  14649. }
  14650. protected function getBinaries(PackageInterface $package)
  14651. {
  14652. return $package->getBinaries();
  14653. }
  14654. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14655. {
  14656. if ('.bat' !== substr($binPath, -4)) {
  14657. $this->installUnixyProxyBinaries($binPath, $link);
  14658. @chmod($link, 0777 & ~umask());
  14659. $link .= '.bat';
  14660. if (file_exists($link)) {
  14661. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14662. }
  14663. }
  14664. if (!file_exists($link)) {
  14665. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14666. }
  14667. }
  14668. protected function installSymlinkBinaries($binPath, $link)
  14669. {
  14670. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14671. $this->installUnixyProxyBinaries($binPath, $link);
  14672. }
  14673. }
  14674. protected function installUnixyProxyBinaries($binPath, $link)
  14675. {
  14676. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14677. }
  14678. protected function initializeBinDir()
  14679. {
  14680. $this->filesystem->ensureDirectoryExists($this->binDir);
  14681. $this->binDir = realpath($this->binDir);
  14682. }
  14683. protected function generateWindowsProxyCode($bin, $link)
  14684. {
  14685. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14686. $caller = self::determineBinaryCaller($bin);
  14687. return "@ECHO OFF\r\n".
  14688. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14689. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14690. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14691. }
  14692. protected function generateUnixyProxyCode($bin, $link)
  14693. {
  14694. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14695. $binDir = ProcessExecutor::escape(dirname($binPath));
  14696. $binFile = basename($binPath);
  14697. $proxyCode = <<<PROXY
  14698. #!/usr/bin/env sh
  14699. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14700. if [ -d /proc/cygdrive ]; then
  14701. case \$(which php) in
  14702. \$(readlink -n /proc/cygdrive)/*)
  14703. # We are in Cygwin using Windows php, so the path must be translated
  14704. dir=\$(cygpath -m "\$dir");
  14705. ;;
  14706. esac
  14707. fi
  14708. "\${dir}/$binFile" "\$@"
  14709. PROXY;
  14710. return $proxyCode;
  14711. }
  14712. }
  14713. <?php
  14714. namespace Composer\Installer;
  14715. use Composer\Package\PackageInterface;
  14716. interface BinaryPresenceInterface
  14717. {
  14718. public function ensureBinariesPresence(PackageInterface $package);
  14719. }
  14720. <?php
  14721. namespace Composer\Installer;
  14722. use Composer\IO\IOInterface;
  14723. use Composer\Package\PackageInterface;
  14724. use Composer\Package\AliasPackage;
  14725. use Composer\Repository\RepositoryInterface;
  14726. use Composer\Repository\InstalledRepositoryInterface;
  14727. use Composer\DependencyResolver\Operation\OperationInterface;
  14728. use Composer\DependencyResolver\Operation\InstallOperation;
  14729. use Composer\DependencyResolver\Operation\UpdateOperation;
  14730. use Composer\DependencyResolver\Operation\UninstallOperation;
  14731. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14732. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14733. use Composer\Util\StreamContextFactory;
  14734. class InstallationManager
  14735. {
  14736. private $installers = array();
  14737. private $cache = array();
  14738. private $notifiablePackages = array();
  14739. public function reset()
  14740. {
  14741. $this->notifiablePackages = array();
  14742. }
  14743. public function addInstaller(InstallerInterface $installer)
  14744. {
  14745. array_unshift($this->installers, $installer);
  14746. $this->cache = array();
  14747. }
  14748. public function removeInstaller(InstallerInterface $installer)
  14749. {
  14750. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14751. array_splice($this->installers, $key, 1);
  14752. $this->cache = array();
  14753. }
  14754. }
  14755. public function disablePlugins()
  14756. {
  14757. foreach ($this->installers as $i => $installer) {
  14758. if (!$installer instanceof PluginInstaller) {
  14759. continue;
  14760. }
  14761. unset($this->installers[$i]);
  14762. }
  14763. }
  14764. public function getInstaller($type)
  14765. {
  14766. $type = strtolower($type);
  14767. if (isset($this->cache[$type])) {
  14768. return $this->cache[$type];
  14769. }
  14770. foreach ($this->installers as $installer) {
  14771. if ($installer->supports($type)) {
  14772. return $this->cache[$type] = $installer;
  14773. }
  14774. }
  14775. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14776. }
  14777. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14778. {
  14779. if ($package instanceof AliasPackage) {
  14780. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14781. }
  14782. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14783. }
  14784. public function ensureBinariesPresence(PackageInterface $package)
  14785. {
  14786. try {
  14787. $installer = $this->getInstaller($package->getType());
  14788. } catch (\InvalidArgumentException $e) {
  14789. return;
  14790. }
  14791. if ($installer instanceof BinaryPresenceInterface) {
  14792. $installer->ensureBinariesPresence($package);
  14793. }
  14794. }
  14795. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14796. {
  14797. $method = $operation->getJobType();
  14798. $this->$method($repo, $operation);
  14799. }
  14800. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14801. {
  14802. $package = $operation->getPackage();
  14803. $installer = $this->getInstaller($package->getType());
  14804. $installer->install($repo, $package);
  14805. $this->markForNotification($package);
  14806. }
  14807. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14808. {
  14809. $initial = $operation->getInitialPackage();
  14810. $target = $operation->getTargetPackage();
  14811. $initialType = $initial->getType();
  14812. $targetType = $target->getType();
  14813. if ($initialType === $targetType) {
  14814. $installer = $this->getInstaller($initialType);
  14815. $installer->update($repo, $initial, $target);
  14816. $this->markForNotification($target);
  14817. } else {
  14818. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14819. $this->getInstaller($targetType)->install($repo, $target);
  14820. }
  14821. }
  14822. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14823. {
  14824. $package = $operation->getPackage();
  14825. $installer = $this->getInstaller($package->getType());
  14826. $installer->uninstall($repo, $package);
  14827. }
  14828. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14829. {
  14830. $package = $operation->getPackage();
  14831. if (!$repo->hasPackage($package)) {
  14832. $repo->addPackage(clone $package);
  14833. }
  14834. }
  14835. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14836. {
  14837. $package = $operation->getPackage();
  14838. $repo->removePackage($package);
  14839. }
  14840. public function getInstallPath(PackageInterface $package)
  14841. {
  14842. $installer = $this->getInstaller($package->getType());
  14843. return $installer->getInstallPath($package);
  14844. }
  14845. public function notifyInstalls(IOInterface $io)
  14846. {
  14847. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14848. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14849. if ($io->hasAuthentication($repositoryName)) {
  14850. $auth = $io->getAuthentication($repositoryName);
  14851. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14852. $authHeader = 'Authorization: Basic '.$authStr;
  14853. }
  14854. if (strpos($repoUrl, '%package%')) {
  14855. foreach ($packages as $package) {
  14856. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14857. $params = array(
  14858. 'version' => $package->getPrettyVersion(),
  14859. 'version_normalized' => $package->getVersion(),
  14860. );
  14861. $opts = array('http' =>
  14862. array(
  14863. 'method' => 'POST',
  14864. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14865. 'content' => http_build_query($params, '', '&'),
  14866. 'timeout' => 3,
  14867. ),
  14868. );
  14869. if (isset($authHeader)) {
  14870. $opts['http']['header'][] = $authHeader;
  14871. }
  14872. $context = StreamContextFactory::getContext($url, $opts);
  14873. @file_get_contents($url, false, $context);
  14874. }
  14875. continue;
  14876. }
  14877. $postData = array('downloads' => array());
  14878. foreach ($packages as $package) {
  14879. $postData['downloads'][] = array(
  14880. 'name' => $package->getPrettyName(),
  14881. 'version' => $package->getVersion(),
  14882. );
  14883. }
  14884. $opts = array('http' =>
  14885. array(
  14886. 'method' => 'POST',
  14887. 'header' => array('Content-Type: application/json'),
  14888. 'content' => json_encode($postData),
  14889. 'timeout' => 6,
  14890. ),
  14891. );
  14892. if (isset($authHeader)) {
  14893. $opts['http']['header'][] = $authHeader;
  14894. }
  14895. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14896. @file_get_contents($repoUrl, false, $context);
  14897. }
  14898. $this->reset();
  14899. }
  14900. private function markForNotification(PackageInterface $package)
  14901. {
  14902. if ($package->getNotificationUrl()) {
  14903. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14904. }
  14905. }
  14906. }
  14907. <?php
  14908. namespace Composer\Installer;
  14909. use Composer\Composer;
  14910. use Composer\DependencyResolver\PolicyInterface;
  14911. use Composer\DependencyResolver\Operation\OperationInterface;
  14912. use Composer\DependencyResolver\Pool;
  14913. use Composer\DependencyResolver\Request;
  14914. use Composer\EventDispatcher\Event;
  14915. use Composer\IO\IOInterface;
  14916. use Composer\Repository\CompositeRepository;
  14917. class InstallerEvent extends Event
  14918. {
  14919. private $composer;
  14920. private $io;
  14921. private $devMode;
  14922. private $policy;
  14923. private $pool;
  14924. private $installedRepo;
  14925. private $request;
  14926. private $operations;
  14927. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14928. {
  14929. parent::__construct($eventName);
  14930. $this->composer = $composer;
  14931. $this->io = $io;
  14932. $this->devMode = $devMode;
  14933. $this->policy = $policy;
  14934. $this->pool = $pool;
  14935. $this->installedRepo = $installedRepo;
  14936. $this->request = $request;
  14937. $this->operations = $operations;
  14938. }
  14939. public function getComposer()
  14940. {
  14941. return $this->composer;
  14942. }
  14943. public function getIO()
  14944. {
  14945. return $this->io;
  14946. }
  14947. public function isDevMode()
  14948. {
  14949. return $this->devMode;
  14950. }
  14951. public function getPolicy()
  14952. {
  14953. return $this->policy;
  14954. }
  14955. public function getPool()
  14956. {
  14957. return $this->pool;
  14958. }
  14959. public function getInstalledRepo()
  14960. {
  14961. return $this->installedRepo;
  14962. }
  14963. public function getRequest()
  14964. {
  14965. return $this->request;
  14966. }
  14967. public function getOperations()
  14968. {
  14969. return $this->operations;
  14970. }
  14971. }
  14972. <?php
  14973. namespace Composer\Installer;
  14974. class InstallerEvents
  14975. {
  14976. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14977. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14978. }
  14979. <?php
  14980. namespace Composer\Installer;
  14981. use Composer\Package\PackageInterface;
  14982. use Composer\Repository\InstalledRepositoryInterface;
  14983. use InvalidArgumentException;
  14984. interface InstallerInterface
  14985. {
  14986. public function supports($packageType);
  14987. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14988. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14989. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14990. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14991. public function getInstallPath(PackageInterface $package);
  14992. }
  14993. <?php
  14994. namespace Composer\Installer;
  14995. use Composer\Composer;
  14996. use Composer\IO\IOInterface;
  14997. use Composer\Repository\InstalledRepositoryInterface;
  14998. use Composer\Package\PackageInterface;
  14999. use Composer\Util\Filesystem;
  15000. use Composer\Util\Silencer;
  15001. use Composer\Util\Platform;
  15002. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15003. {
  15004. protected $composer;
  15005. protected $vendorDir;
  15006. protected $binDir;
  15007. protected $downloadManager;
  15008. protected $io;
  15009. protected $type;
  15010. protected $filesystem;
  15011. protected $binCompat;
  15012. protected $binaryInstaller;
  15013. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15014. {
  15015. $this->composer = $composer;
  15016. $this->downloadManager = $composer->getDownloadManager();
  15017. $this->io = $io;
  15018. $this->type = $type;
  15019. $this->filesystem = $filesystem ?: new Filesystem();
  15020. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15021. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15022. }
  15023. public function supports($packageType)
  15024. {
  15025. return $packageType === $this->type || null === $this->type;
  15026. }
  15027. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15028. {
  15029. if (!$repo->hasPackage($package)) {
  15030. return false;
  15031. }
  15032. $installPath = $this->getInstallPath($package);
  15033. if (is_readable($installPath)) {
  15034. return true;
  15035. }
  15036. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15037. }
  15038. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15039. {
  15040. $this->initializeVendorDir();
  15041. $downloadPath = $this->getInstallPath($package);
  15042. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15043. $this->binaryInstaller->removeBinaries($package);
  15044. }
  15045. $this->installCode($package);
  15046. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15047. if (!$repo->hasPackage($package)) {
  15048. $repo->addPackage(clone $package);
  15049. }
  15050. }
  15051. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15052. {
  15053. if (!$repo->hasPackage($initial)) {
  15054. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15055. }
  15056. $this->initializeVendorDir();
  15057. $this->binaryInstaller->removeBinaries($initial);
  15058. $this->updateCode($initial, $target);
  15059. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15060. $repo->removePackage($initial);
  15061. if (!$repo->hasPackage($target)) {
  15062. $repo->addPackage(clone $target);
  15063. }
  15064. }
  15065. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15066. {
  15067. if (!$repo->hasPackage($package)) {
  15068. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15069. }
  15070. $this->removeCode($package);
  15071. $this->binaryInstaller->removeBinaries($package);
  15072. $repo->removePackage($package);
  15073. $downloadPath = $this->getPackageBasePath($package);
  15074. if (strpos($package->getName(), '/')) {
  15075. $packageVendorDir = dirname($downloadPath);
  15076. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15077. Silencer::call('rmdir', $packageVendorDir);
  15078. }
  15079. }
  15080. }
  15081. public function getInstallPath(PackageInterface $package)
  15082. {
  15083. $this->initializeVendorDir();
  15084. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15085. $targetDir = $package->getTargetDir();
  15086. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15087. }
  15088. public function ensureBinariesPresence(PackageInterface $package)
  15089. {
  15090. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15091. }
  15092. protected function getPackageBasePath(PackageInterface $package)
  15093. {
  15094. $installPath = $this->getInstallPath($package);
  15095. $targetDir = $package->getTargetDir();
  15096. if ($targetDir) {
  15097. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15098. }
  15099. return $installPath;
  15100. }
  15101. protected function installCode(PackageInterface $package)
  15102. {
  15103. $downloadPath = $this->getInstallPath($package);
  15104. $this->downloadManager->download($package, $downloadPath);
  15105. }
  15106. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15107. {
  15108. $initialDownloadPath = $this->getInstallPath($initial);
  15109. $targetDownloadPath = $this->getInstallPath($target);
  15110. if ($targetDownloadPath !== $initialDownloadPath) {
  15111. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15112. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15113. ) {
  15114. $this->removeCode($initial);
  15115. $this->installCode($target);
  15116. return;
  15117. }
  15118. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15119. }
  15120. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15121. }
  15122. protected function removeCode(PackageInterface $package)
  15123. {
  15124. $downloadPath = $this->getPackageBasePath($package);
  15125. $this->downloadManager->remove($package, $downloadPath);
  15126. }
  15127. protected function initializeVendorDir()
  15128. {
  15129. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15130. $this->vendorDir = realpath($this->vendorDir);
  15131. }
  15132. }
  15133. <?php
  15134. namespace Composer\Installer;
  15135. use Composer\Repository\InstalledRepositoryInterface;
  15136. use Composer\Package\PackageInterface;
  15137. use Composer\Package\Version\VersionParser;
  15138. use Composer\IO\IOInterface;
  15139. class MetapackageInstaller implements InstallerInterface
  15140. {
  15141. private $io;
  15142. public function __construct(IOInterface $io)
  15143. {
  15144. $this->io = $io;
  15145. }
  15146. public function supports($packageType)
  15147. {
  15148. return $packageType === 'metapackage';
  15149. }
  15150. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15151. {
  15152. return $repo->hasPackage($package);
  15153. }
  15154. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15155. {
  15156. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15157. $repo->addPackage(clone $package);
  15158. }
  15159. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15160. {
  15161. if (!$repo->hasPackage($initial)) {
  15162. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15163. }
  15164. $name = $target->getName();
  15165. $from = $initial->getFullPrettyVersion();
  15166. $to = $target->getFullPrettyVersion();
  15167. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15168. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15169. $repo->removePackage($initial);
  15170. $repo->addPackage(clone $target);
  15171. }
  15172. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15173. {
  15174. if (!$repo->hasPackage($package)) {
  15175. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15176. }
  15177. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15178. $repo->removePackage($package);
  15179. }
  15180. public function getInstallPath(PackageInterface $package)
  15181. {
  15182. return '';
  15183. }
  15184. }
  15185. <?php
  15186. namespace Composer\Installer;
  15187. use Composer\Repository\InstalledRepositoryInterface;
  15188. use Composer\Package\PackageInterface;
  15189. class NoopInstaller implements InstallerInterface
  15190. {
  15191. public function supports($packageType)
  15192. {
  15193. return true;
  15194. }
  15195. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15196. {
  15197. return $repo->hasPackage($package);
  15198. }
  15199. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15200. {
  15201. if (!$repo->hasPackage($package)) {
  15202. $repo->addPackage(clone $package);
  15203. }
  15204. }
  15205. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15206. {
  15207. if (!$repo->hasPackage($initial)) {
  15208. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15209. }
  15210. $repo->removePackage($initial);
  15211. if (!$repo->hasPackage($target)) {
  15212. $repo->addPackage(clone $target);
  15213. }
  15214. }
  15215. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15216. {
  15217. if (!$repo->hasPackage($package)) {
  15218. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15219. }
  15220. $repo->removePackage($package);
  15221. }
  15222. public function getInstallPath(PackageInterface $package)
  15223. {
  15224. $targetDir = $package->getTargetDir();
  15225. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15226. }
  15227. }
  15228. <?php
  15229. namespace Composer\Installer;
  15230. use Composer\Composer;
  15231. use Composer\IO\IOInterface;
  15232. use Composer\DependencyResolver\Operation\OperationInterface;
  15233. use Composer\DependencyResolver\PolicyInterface;
  15234. use Composer\DependencyResolver\Pool;
  15235. use Composer\DependencyResolver\Request;
  15236. use Composer\Repository\CompositeRepository;
  15237. class PackageEvent extends InstallerEvent
  15238. {
  15239. private $operation;
  15240. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15241. {
  15242. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15243. $this->operation = $operation;
  15244. }
  15245. public function getOperation()
  15246. {
  15247. return $this->operation;
  15248. }
  15249. }
  15250. <?php
  15251. namespace Composer\Installer;
  15252. class PackageEvents
  15253. {
  15254. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15255. const POST_PACKAGE_INSTALL = 'post-package-install';
  15256. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15257. const POST_PACKAGE_UPDATE = 'post-package-update';
  15258. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15259. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15260. }
  15261. <?php
  15262. namespace Composer\Installer;
  15263. use Composer\IO\IOInterface;
  15264. use Composer\Package\PackageInterface;
  15265. use Composer\Util\Filesystem;
  15266. use Composer\Util\ProcessExecutor;
  15267. class PearBinaryInstaller extends BinaryInstaller
  15268. {
  15269. private $installer;
  15270. private $vendorDir;
  15271. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15272. {
  15273. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15274. $this->installer = $installer;
  15275. $this->vendorDir = $vendorDir;
  15276. }
  15277. protected function getBinaries(PackageInterface $package)
  15278. {
  15279. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15280. $binaries = array();
  15281. if (file_exists($binariesPath)) {
  15282. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15283. if (!$value->isDir()) {
  15284. $binaries[] = 'bin/'.$fileName;
  15285. }
  15286. }
  15287. }
  15288. return $binaries;
  15289. }
  15290. protected function initializeBinDir()
  15291. {
  15292. parent::initializeBinDir();
  15293. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  15294. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  15295. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  15296. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  15297. }
  15298. protected function generateWindowsProxyCode($bin, $link)
  15299. {
  15300. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15301. if ('.bat' === substr($bin, -4)) {
  15302. $caller = 'call';
  15303. } else {
  15304. $handle = fopen($bin, 'r');
  15305. $line = fgets($handle);
  15306. fclose($handle);
  15307. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15308. $caller = trim($match[1]);
  15309. } else {
  15310. $caller = 'php';
  15311. }
  15312. if ($caller === 'php') {
  15313. return "@echo off\r\n".
  15314. "pushd .\r\n".
  15315. "cd %~dp0\r\n".
  15316. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  15317. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15318. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15319. "popd\r\n".
  15320. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  15321. }
  15322. }
  15323. return "@echo off\r\n".
  15324. "pushd .\r\n".
  15325. "cd %~dp0\r\n".
  15326. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15327. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15328. "popd\r\n".
  15329. $caller." \"%BIN_TARGET%\" %*\r\n";
  15330. }
  15331. private function generateWindowsPhpProxyCode()
  15332. {
  15333. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15334. return
  15335. "@echo off\r\n" .
  15336. "setlocal enabledelayedexpansion\r\n" .
  15337. "set BIN_DIR=%~dp0\r\n" .
  15338. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15339. "set DIRS=.\r\n" .
  15340. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15341. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15342. " set DIRS=!DIRS!;%%~fP\r\n" .
  15343. " )\r\n" .
  15344. ")\r\n" .
  15345. "php.exe -d include_path=!DIRS! %*\r\n";
  15346. }
  15347. private function generateUnixyPhpProxyCode()
  15348. {
  15349. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15350. return
  15351. "#!/usr/bin/env sh\n".
  15352. "SRC_DIR=`pwd`\n".
  15353. "BIN_DIR=`dirname $0`\n".
  15354. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15355. "DIRS=\"\"\n".
  15356. "for vendor in \$VENDOR_DIR/*; do\n".
  15357. " if [ -d \"\$vendor\" ]; then\n".
  15358. " for package in \$vendor/*; do\n".
  15359. " if [ -d \"\$package\" ]; then\n".
  15360. " DIRS=\"\${DIRS}:\${package}\"\n".
  15361. " fi\n".
  15362. " done\n".
  15363. " fi\n".
  15364. "done\n".
  15365. "php -d include_path=\".\$DIRS\" $@\n";
  15366. }
  15367. }
  15368. <?php
  15369. namespace Composer\Installer;
  15370. use Composer\IO\IOInterface;
  15371. use Composer\Composer;
  15372. use Composer\Downloader\PearPackageExtractor;
  15373. use Composer\Repository\InstalledRepositoryInterface;
  15374. use Composer\Package\PackageInterface;
  15375. use Composer\Util\Platform;
  15376. use Composer\Util\Filesystem;
  15377. class PearInstaller extends LibraryInstaller
  15378. {
  15379. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15380. {
  15381. $filesystem = new Filesystem();
  15382. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15383. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15384. }
  15385. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15386. {
  15387. $this->uninstall($repo, $initial);
  15388. $this->install($repo, $target);
  15389. }
  15390. protected function installCode(PackageInterface $package)
  15391. {
  15392. parent::installCode($package);
  15393. $isWindows = Platform::isWindows();
  15394. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15395. if (!$isWindows) {
  15396. $php_bin = '/usr/bin/env ' . $php_bin;
  15397. }
  15398. $installPath = $this->getInstallPath($package);
  15399. $vars = array(
  15400. 'os' => $isWindows ? 'windows' : 'linux',
  15401. 'php_bin' => $php_bin,
  15402. 'pear_php' => $installPath,
  15403. 'php_dir' => $installPath,
  15404. 'bin_dir' => $installPath . '/bin',
  15405. 'data_dir' => $installPath . '/data',
  15406. 'version' => $package->getPrettyVersion(),
  15407. );
  15408. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15409. $pearExtractor = new PearPackageExtractor($packageArchive);
  15410. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15411. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15412. $this->filesystem->unlink($packageArchive);
  15413. }
  15414. }
  15415. <?php
  15416. namespace Composer\Installer;
  15417. use Composer\Composer;
  15418. use Composer\IO\IOInterface;
  15419. use Composer\Repository\InstalledRepositoryInterface;
  15420. use Composer\Package\PackageInterface;
  15421. class PluginInstaller extends LibraryInstaller
  15422. {
  15423. private $installationManager;
  15424. public function __construct(IOInterface $io, Composer $composer)
  15425. {
  15426. parent::__construct($io, $composer, 'composer-plugin');
  15427. $this->installationManager = $composer->getInstallationManager();
  15428. }
  15429. public function supports($packageType)
  15430. {
  15431. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15432. }
  15433. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15434. {
  15435. $extra = $package->getExtra();
  15436. if (empty($extra['class'])) {
  15437. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15438. }
  15439. parent::install($repo, $package);
  15440. try {
  15441. $this->composer->getPluginManager()->registerPackage($package, true);
  15442. } catch (\Exception $e) {
  15443. $this->io->writeError('Plugin installation failed, rolling back');
  15444. parent::uninstall($repo, $package);
  15445. throw $e;
  15446. }
  15447. }
  15448. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15449. {
  15450. $extra = $target->getExtra();
  15451. if (empty($extra['class'])) {
  15452. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15453. }
  15454. parent::update($repo, $initial, $target);
  15455. $this->composer->getPluginManager()->registerPackage($target, true);
  15456. }
  15457. }
  15458. <?php
  15459. namespace Composer\Installer;
  15460. use Composer\Package\PackageInterface;
  15461. use Composer\Downloader\DownloadManager;
  15462. use Composer\Repository\InstalledRepositoryInterface;
  15463. use Composer\Util\Filesystem;
  15464. class ProjectInstaller implements InstallerInterface
  15465. {
  15466. private $installPath;
  15467. private $downloadManager;
  15468. private $filesystem;
  15469. public function __construct($installPath, DownloadManager $dm)
  15470. {
  15471. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15472. $this->downloadManager = $dm;
  15473. $this->filesystem = new Filesystem;
  15474. }
  15475. public function supports($packageType)
  15476. {
  15477. return true;
  15478. }
  15479. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15480. {
  15481. return false;
  15482. }
  15483. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15484. {
  15485. $installPath = $this->installPath;
  15486. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15487. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15488. }
  15489. if (!is_dir($installPath)) {
  15490. mkdir($installPath, 0777, true);
  15491. }
  15492. $this->downloadManager->download($package, $installPath);
  15493. }
  15494. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15495. {
  15496. throw new \InvalidArgumentException("not supported");
  15497. }
  15498. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15499. {
  15500. throw new \InvalidArgumentException("not supported");
  15501. }
  15502. public function getInstallPath(PackageInterface $package)
  15503. {
  15504. return $this->installPath;
  15505. }
  15506. }
  15507. <?php
  15508. namespace Composer\Installer;
  15509. use Composer\IO\IOInterface;
  15510. use Composer\Package\PackageInterface;
  15511. use Composer\Repository\RepositoryInterface;
  15512. use Symfony\Component\Console\Formatter\OutputFormatter;
  15513. class SuggestedPackagesReporter
  15514. {
  15515. protected $suggestedPackages = array();
  15516. private $io;
  15517. public function __construct(IOInterface $io)
  15518. {
  15519. $this->io = $io;
  15520. }
  15521. public function getPackages()
  15522. {
  15523. return $this->suggestedPackages;
  15524. }
  15525. public function addPackage($source, $target, $reason)
  15526. {
  15527. $this->suggestedPackages[] = array(
  15528. 'source' => $source,
  15529. 'target' => $target,
  15530. 'reason' => $reason,
  15531. );
  15532. return $this;
  15533. }
  15534. public function addSuggestionsFromPackage(PackageInterface $package)
  15535. {
  15536. $source = $package->getPrettyName();
  15537. foreach ($package->getSuggests() as $target => $reason) {
  15538. $this->addPackage(
  15539. $source,
  15540. $target,
  15541. $reason
  15542. );
  15543. }
  15544. return $this;
  15545. }
  15546. public function output(RepositoryInterface $installedRepo = null)
  15547. {
  15548. $suggestedPackages = $this->getPackages();
  15549. $installedPackages = array();
  15550. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15551. foreach ($installedRepo->getPackages() as $package) {
  15552. $installedPackages = array_merge(
  15553. $installedPackages,
  15554. $package->getNames()
  15555. );
  15556. }
  15557. }
  15558. foreach ($suggestedPackages as $suggestion) {
  15559. if (in_array($suggestion['target'], $installedPackages)) {
  15560. continue;
  15561. }
  15562. $this->io->writeError(sprintf(
  15563. '%s suggests installing %s%s',
  15564. $suggestion['source'],
  15565. $this->escapeOutput($suggestion['target']),
  15566. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15567. ));
  15568. }
  15569. return $this;
  15570. }
  15571. private function escapeOutput($string)
  15572. {
  15573. return OutputFormatter::escape(
  15574. $this->removeControlCharacters($string)
  15575. );
  15576. }
  15577. private function removeControlCharacters($string)
  15578. {
  15579. return preg_replace(
  15580. '/[[:cntrl:]]/',
  15581. '',
  15582. str_replace("\n", ' ', $string)
  15583. );
  15584. }
  15585. }
  15586. <?php
  15587. namespace Composer\Json;
  15588. use JsonSchema\Validator;
  15589. use Seld\JsonLint\JsonParser;
  15590. use Seld\JsonLint\ParsingException;
  15591. use Composer\Util\RemoteFilesystem;
  15592. use Composer\IO\IOInterface;
  15593. use Composer\Downloader\TransportException;
  15594. class JsonFile
  15595. {
  15596. const LAX_SCHEMA = 1;
  15597. const STRICT_SCHEMA = 2;
  15598. const JSON_UNESCAPED_SLASHES = 64;
  15599. const JSON_PRETTY_PRINT = 128;
  15600. const JSON_UNESCAPED_UNICODE = 256;
  15601. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  15602. private $path;
  15603. private $rfs;
  15604. private $io;
  15605. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15606. {
  15607. $this->path = $path;
  15608. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15609. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15610. }
  15611. $this->rfs = $rfs;
  15612. $this->io = $io;
  15613. }
  15614. public function getPath()
  15615. {
  15616. return $this->path;
  15617. }
  15618. public function exists()
  15619. {
  15620. return is_file($this->path);
  15621. }
  15622. public function read()
  15623. {
  15624. try {
  15625. if ($this->rfs) {
  15626. $json = $this->rfs->getContents($this->path, $this->path, false);
  15627. } else {
  15628. if ($this->io && $this->io->isDebug()) {
  15629. $this->io->writeError('Reading ' . $this->path);
  15630. }
  15631. $json = file_get_contents($this->path);
  15632. }
  15633. } catch (TransportException $e) {
  15634. throw new \RuntimeException($e->getMessage(), 0, $e);
  15635. } catch (\Exception $e) {
  15636. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15637. }
  15638. return static::parseJson($json, $this->path);
  15639. }
  15640. public function write(array $hash, $options = 448)
  15641. {
  15642. $dir = dirname($this->path);
  15643. if (!is_dir($dir)) {
  15644. if (file_exists($dir)) {
  15645. throw new \UnexpectedValueException(
  15646. $dir.' exists and is not a directory.'
  15647. );
  15648. }
  15649. if (!@mkdir($dir, 0777, true)) {
  15650. throw new \UnexpectedValueException(
  15651. $dir.' does not exist and could not be created.'
  15652. );
  15653. }
  15654. }
  15655. $retries = 3;
  15656. while ($retries--) {
  15657. try {
  15658. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15659. break;
  15660. } catch (\Exception $e) {
  15661. if ($retries) {
  15662. usleep(500000);
  15663. continue;
  15664. }
  15665. throw $e;
  15666. }
  15667. }
  15668. }
  15669. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  15670. {
  15671. $content = file_get_contents($this->path);
  15672. $data = json_decode($content);
  15673. if (null === $data && 'null' !== $content) {
  15674. self::validateSyntax($content, $this->path);
  15675. }
  15676. if (null === $schemaFile) {
  15677. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  15678. }
  15679. if (false === strpos($schemaFile, '://')) {
  15680. $schemaFile = 'file://' . $schemaFile;
  15681. }
  15682. $schemaData = (object) array('$ref' => $schemaFile);
  15683. if ($schema === self::LAX_SCHEMA) {
  15684. $schemaData->additionalProperties = true;
  15685. $schemaData->required = array();
  15686. }
  15687. $validator = new Validator();
  15688. $validator->check($data, $schemaData);
  15689. if (!$validator->isValid()) {
  15690. $errors = array();
  15691. foreach ((array) $validator->getErrors() as $error) {
  15692. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15693. }
  15694. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15695. }
  15696. return true;
  15697. }
  15698. public static function encode($data, $options = 448)
  15699. {
  15700. if (PHP_VERSION_ID >= 50400) {
  15701. $json = json_encode($data, $options);
  15702. if (false === $json) {
  15703. self::throwEncodeError(json_last_error());
  15704. }
  15705. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15706. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15707. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15708. }
  15709. return $json;
  15710. }
  15711. $json = json_encode($data);
  15712. if (false === $json) {
  15713. self::throwEncodeError(json_last_error());
  15714. }
  15715. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15716. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15717. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15718. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15719. return $json;
  15720. }
  15721. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15722. }
  15723. private static function throwEncodeError($code)
  15724. {
  15725. switch ($code) {
  15726. case JSON_ERROR_DEPTH:
  15727. $msg = 'Maximum stack depth exceeded';
  15728. break;
  15729. case JSON_ERROR_STATE_MISMATCH:
  15730. $msg = 'Underflow or the modes mismatch';
  15731. break;
  15732. case JSON_ERROR_CTRL_CHAR:
  15733. $msg = 'Unexpected control character found';
  15734. break;
  15735. case JSON_ERROR_UTF8:
  15736. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15737. break;
  15738. default:
  15739. $msg = 'Unknown error';
  15740. }
  15741. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15742. }
  15743. public static function parseJson($json, $file = null)
  15744. {
  15745. if (null === $json) {
  15746. return;
  15747. }
  15748. $data = json_decode($json, true);
  15749. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15750. self::validateSyntax($json, $file);
  15751. }
  15752. return $data;
  15753. }
  15754. protected static function validateSyntax($json, $file = null)
  15755. {
  15756. $parser = new JsonParser();
  15757. $result = $parser->lint($json);
  15758. if (null === $result) {
  15759. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15760. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15761. }
  15762. return true;
  15763. }
  15764. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15765. }
  15766. }
  15767. <?php
  15768. namespace Composer\Json;
  15769. class JsonFormatter
  15770. {
  15771. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15772. {
  15773. $result = '';
  15774. $pos = 0;
  15775. $strLen = strlen($json);
  15776. $indentStr = ' ';
  15777. $newLine = "\n";
  15778. $outOfQuotes = true;
  15779. $buffer = '';
  15780. $noescape = true;
  15781. for ($i = 0; $i < $strLen; $i++) {
  15782. $char = substr($json, $i, 1);
  15783. if ('"' === $char && $noescape) {
  15784. $outOfQuotes = !$outOfQuotes;
  15785. }
  15786. if (!$outOfQuotes) {
  15787. $buffer .= $char;
  15788. $noescape = '\\' === $char ? !$noescape : true;
  15789. continue;
  15790. } elseif ('' !== $buffer) {
  15791. if ($unescapeSlashes) {
  15792. $buffer = str_replace('\\/', '/', $buffer);
  15793. }
  15794. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15795. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15796. $l = strlen($match[1]);
  15797. if ($l % 2) {
  15798. $code = hexdec($match[2]);
  15799. if (0xD800 <= $code && 0xDFFF >= $code) {
  15800. return $match[0];
  15801. }
  15802. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15803. pack('H*', $match[2]),
  15804. 'UTF-8',
  15805. 'UCS-2BE'
  15806. );
  15807. }
  15808. return $match[0];
  15809. }, $buffer);
  15810. }
  15811. $result .= $buffer.$char;
  15812. $buffer = '';
  15813. continue;
  15814. }
  15815. if (':' === $char) {
  15816. $char .= ' ';
  15817. } elseif ('}' === $char || ']' === $char) {
  15818. $pos--;
  15819. $prevChar = substr($json, $i - 1, 1);
  15820. if ('{' !== $prevChar && '[' !== $prevChar) {
  15821. $result .= $newLine;
  15822. for ($j = 0; $j < $pos; $j++) {
  15823. $result .= $indentStr;
  15824. }
  15825. } else {
  15826. $result = rtrim($result);
  15827. }
  15828. }
  15829. $result .= $char;
  15830. if (',' === $char || '{' === $char || '[' === $char) {
  15831. $result .= $newLine;
  15832. if ('{' === $char || '[' === $char) {
  15833. $pos++;
  15834. }
  15835. for ($j = 0; $j < $pos; $j++) {
  15836. $result .= $indentStr;
  15837. }
  15838. }
  15839. }
  15840. return $result;
  15841. }
  15842. }
  15843. <?php
  15844. namespace Composer\Json;
  15845. use Composer\Repository\PlatformRepository;
  15846. class JsonManipulator
  15847. {
  15848. private static $DEFINES = '(?(DEFINE)
  15849. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15850. (?<boolean> true | false | null )
  15851. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  15852. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15853. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15854. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15855. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15856. )';
  15857. private $contents;
  15858. private $newline;
  15859. private $indent;
  15860. public function __construct($contents)
  15861. {
  15862. $contents = trim($contents);
  15863. if ($contents === '') {
  15864. $contents = '{}';
  15865. }
  15866. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15867. throw new \InvalidArgumentException('The json file must be an object ({})');
  15868. }
  15869. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15870. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15871. $this->detectIndenting();
  15872. }
  15873. public function getContents()
  15874. {
  15875. return $this->contents . $this->newline;
  15876. }
  15877. public function addLink($type, $package, $constraint, $sortPackages = false)
  15878. {
  15879. $decoded = JsonFile::parseJson($this->contents);
  15880. if (!isset($decoded[$type])) {
  15881. return $this->addMainKey($type, array($package => $constraint));
  15882. }
  15883. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15884. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15885. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15886. return false;
  15887. }
  15888. $links = $matches['value'];
  15889. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15890. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15891. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15892. $existingPackage = $packageMatches['package'];
  15893. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15894. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15895. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15896. }, $links);
  15897. } else {
  15898. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15899. $links = preg_replace(
  15900. '{'.preg_quote($match[1]).'$}',
  15901. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15902. $links
  15903. );
  15904. } else {
  15905. $links = '{' . $this->newline .
  15906. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15907. $this->indent . '}';
  15908. }
  15909. }
  15910. if (true === $sortPackages) {
  15911. $requirements = json_decode($links, true);
  15912. $this->sortPackages($requirements);
  15913. $links = $this->format($requirements);
  15914. }
  15915. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15916. return true;
  15917. }
  15918. private function sortPackages(array &$packages = array())
  15919. {
  15920. $prefix = function ($requirement) {
  15921. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15922. return preg_replace(
  15923. array(
  15924. '/^php/',
  15925. '/^hhvm/',
  15926. '/^ext/',
  15927. '/^lib/',
  15928. '/^\D/',
  15929. ),
  15930. array(
  15931. '0-$0',
  15932. '1-$0',
  15933. '2-$0',
  15934. '3-$0',
  15935. '4-$0',
  15936. ),
  15937. $requirement
  15938. );
  15939. }
  15940. return '5-'.$requirement;
  15941. };
  15942. uksort($packages, function ($a, $b) use ($prefix) {
  15943. return strnatcmp($prefix($a), $prefix($b));
  15944. });
  15945. }
  15946. public function addRepository($name, $config)
  15947. {
  15948. return $this->addSubNode('repositories', $name, $config);
  15949. }
  15950. public function removeRepository($name)
  15951. {
  15952. return $this->removeSubNode('repositories', $name);
  15953. }
  15954. public function addConfigSetting($name, $value)
  15955. {
  15956. return $this->addSubNode('config', $name, $value);
  15957. }
  15958. public function removeConfigSetting($name)
  15959. {
  15960. return $this->removeSubNode('config', $name);
  15961. }
  15962. public function addProperty($name, $value)
  15963. {
  15964. if (substr($name, 0, 6) === 'extra.') {
  15965. return $this->addSubNode('extra', substr($name, 6), $value);
  15966. }
  15967. if (substr($name, 0, 8) === 'scripts.') {
  15968. return $this->addSubNode('scripts', substr($name, 8), $value);
  15969. }
  15970. return $this->addMainKey($name, $value);
  15971. }
  15972. public function removeProperty($name)
  15973. {
  15974. if (substr($name, 0, 6) === 'extra.') {
  15975. return $this->removeSubNode('extra', substr($name, 6));
  15976. }
  15977. if (substr($name, 0, 8) === 'scripts.') {
  15978. return $this->removeSubNode('scripts', substr($name, 8));
  15979. }
  15980. return $this->removeMainKey($name);
  15981. }
  15982. public function addSubNode($mainNode, $name, $value)
  15983. {
  15984. $decoded = JsonFile::parseJson($this->contents);
  15985. $subName = null;
  15986. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15987. list($name, $subName) = explode('.', $name, 2);
  15988. }
  15989. if (!isset($decoded[$mainNode])) {
  15990. if ($subName !== null) {
  15991. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15992. } else {
  15993. $this->addMainKey($mainNode, array($name => $value));
  15994. }
  15995. return true;
  15996. }
  15997. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15998. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15999. try {
  16000. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16001. return false;
  16002. }
  16003. } catch (\RuntimeException $e) {
  16004. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16005. return false;
  16006. }
  16007. throw $e;
  16008. }
  16009. $children = $match['content'];
  16010. if (!@json_decode($children)) {
  16011. return false;
  16012. }
  16013. $that = $this;
  16014. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16015. if ($this->pregMatch($childRegex, $children, $matches)) {
  16016. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16017. if ($subName !== null) {
  16018. $curVal = json_decode($matches['content'], true);
  16019. if (!is_array($curVal)) {
  16020. $curVal = array();
  16021. }
  16022. $curVal[$subName] = $value;
  16023. $value = $curVal;
  16024. }
  16025. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16026. }, $children);
  16027. } else {
  16028. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16029. $whitespace = '';
  16030. if (!empty($match['trailingspace'])) {
  16031. $whitespace = $match['trailingspace'];
  16032. }
  16033. if (!empty($match['content'])) {
  16034. if ($subName !== null) {
  16035. $value = array($subName => $value);
  16036. }
  16037. $children = preg_replace(
  16038. '#'.$whitespace.'}$#',
  16039. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16040. $children
  16041. );
  16042. } else {
  16043. if ($subName !== null) {
  16044. $value = array($subName => $value);
  16045. }
  16046. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16047. }
  16048. }
  16049. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16050. return $m['start'] . $children . $m['end'];
  16051. }, $this->contents);
  16052. return true;
  16053. }
  16054. public function removeSubNode($mainNode, $name)
  16055. {
  16056. $decoded = JsonFile::parseJson($this->contents);
  16057. if (empty($decoded[$mainNode])) {
  16058. return true;
  16059. }
  16060. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16061. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16062. try {
  16063. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16064. return false;
  16065. }
  16066. } catch (\RuntimeException $e) {
  16067. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16068. return false;
  16069. }
  16070. throw $e;
  16071. }
  16072. $children = $match['content'];
  16073. if (!@json_decode($children, true)) {
  16074. return false;
  16075. }
  16076. $subName = null;
  16077. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16078. list($name, $subName) = explode('.', $name, 2);
  16079. }
  16080. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16081. return true;
  16082. }
  16083. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16084. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16085. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16086. $bestMatch = '';
  16087. foreach ($matches[0] as $match) {
  16088. if (strlen($bestMatch) < strlen($match)) {
  16089. $bestMatch = $match;
  16090. }
  16091. }
  16092. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16093. if (1 !== $count) {
  16094. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16095. if (1 !== $count) {
  16096. return false;
  16097. }
  16098. }
  16099. }
  16100. } else {
  16101. $childrenClean = $children;
  16102. }
  16103. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16104. if (empty($match['content'])) {
  16105. $newline = $this->newline;
  16106. $indent = $this->indent;
  16107. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16108. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16109. }, $this->contents);
  16110. if ($subName !== null) {
  16111. $curVal = json_decode($children, true);
  16112. unset($curVal[$name][$subName]);
  16113. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16114. }
  16115. return true;
  16116. }
  16117. $that = $this;
  16118. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16119. if ($subName !== null) {
  16120. $curVal = json_decode($matches['content'], true);
  16121. unset($curVal[$name][$subName]);
  16122. $childrenClean = $that->format($curVal, 0);
  16123. }
  16124. return $matches['start'] . $childrenClean . $matches['end'];
  16125. }, $this->contents);
  16126. return true;
  16127. }
  16128. public function addMainKey($key, $content)
  16129. {
  16130. $decoded = JsonFile::parseJson($this->contents);
  16131. $content = $this->format($content);
  16132. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16133. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16134. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16135. if (!@json_decode('{'.$matches['key'].'}')) {
  16136. return false;
  16137. }
  16138. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16139. return true;
  16140. }
  16141. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16142. $this->contents = preg_replace(
  16143. '#'.$match[1].'\}$#',
  16144. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16145. $this->contents
  16146. );
  16147. return true;
  16148. }
  16149. $this->contents = preg_replace(
  16150. '#\}$#',
  16151. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16152. $this->contents
  16153. );
  16154. return true;
  16155. }
  16156. public function removeMainKey($key)
  16157. {
  16158. $decoded = JsonFile::parseJson($this->contents);
  16159. if (!array_key_exists($key, $decoded)) {
  16160. return true;
  16161. }
  16162. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16163. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16164. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16165. if (!@json_decode('{'.$matches['removal'].'}')) {
  16166. return false;
  16167. }
  16168. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16169. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16170. }
  16171. $this->contents = $matches['start'] . $matches['end'];
  16172. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16173. $this->contents = "{\n}";
  16174. }
  16175. return true;
  16176. }
  16177. return false;
  16178. }
  16179. public function format($data, $depth = 0)
  16180. {
  16181. if (is_array($data)) {
  16182. reset($data);
  16183. if (is_numeric(key($data))) {
  16184. foreach ($data as $key => $val) {
  16185. $data[$key] = $this->format($val, $depth + 1);
  16186. }
  16187. return '['.implode(', ', $data).']';
  16188. }
  16189. $out = '{' . $this->newline;
  16190. $elems = array();
  16191. foreach ($data as $key => $val) {
  16192. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16193. }
  16194. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16195. }
  16196. return JsonFile::encode($data);
  16197. }
  16198. protected function detectIndenting()
  16199. {
  16200. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16201. $this->indent = $match[1];
  16202. } else {
  16203. $this->indent = ' ';
  16204. }
  16205. }
  16206. protected function pregMatch($re, $str, &$matches = array())
  16207. {
  16208. $count = preg_match($re, $str, $matches);
  16209. if ($count === false) {
  16210. switch (preg_last_error()) {
  16211. case PREG_NO_ERROR:
  16212. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16213. case PREG_INTERNAL_ERROR:
  16214. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16215. case PREG_BACKTRACK_LIMIT_ERROR:
  16216. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16217. case PREG_RECURSION_LIMIT_ERROR:
  16218. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16219. case PREG_BAD_UTF8_ERROR:
  16220. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16221. case PREG_BAD_UTF8_OFFSET_ERROR:
  16222. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16223. case 6:
  16224. if (PHP_VERSION_ID > 70000) {
  16225. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16226. }
  16227. default:
  16228. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16229. }
  16230. }
  16231. return $count;
  16232. }
  16233. }
  16234. <?php
  16235. namespace Composer\Json;
  16236. use Exception;
  16237. class JsonValidationException extends Exception
  16238. {
  16239. protected $errors;
  16240. public function __construct($message, $errors = array(), Exception $previous = null)
  16241. {
  16242. $this->errors = $errors;
  16243. parent::__construct($message, 0, $previous);
  16244. }
  16245. public function getErrors()
  16246. {
  16247. return $this->errors;
  16248. }
  16249. }
  16250. <?php
  16251. namespace Composer\Package;
  16252. use Composer\Semver\Constraint\Constraint;
  16253. use Composer\Package\Version\VersionParser;
  16254. class AliasPackage extends BasePackage implements CompletePackageInterface
  16255. {
  16256. protected $version;
  16257. protected $prettyVersion;
  16258. protected $dev;
  16259. protected $rootPackageAlias = false;
  16260. protected $stability;
  16261. protected $aliasOf;
  16262. protected $requires;
  16263. protected $devRequires;
  16264. protected $conflicts;
  16265. protected $provides;
  16266. protected $replaces;
  16267. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16268. {
  16269. parent::__construct($aliasOf->getName());
  16270. $this->version = $version;
  16271. $this->prettyVersion = $prettyVersion;
  16272. $this->aliasOf = $aliasOf;
  16273. $this->stability = VersionParser::parseStability($version);
  16274. $this->dev = $this->stability === 'dev';
  16275. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16276. $links = $aliasOf->{'get' . ucfirst($type)}();
  16277. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16278. }
  16279. }
  16280. public function getAliasOf()
  16281. {
  16282. return $this->aliasOf;
  16283. }
  16284. public function getVersion()
  16285. {
  16286. return $this->version;
  16287. }
  16288. public function getStability()
  16289. {
  16290. return $this->stability;
  16291. }
  16292. public function getPrettyVersion()
  16293. {
  16294. return $this->prettyVersion;
  16295. }
  16296. public function isDev()
  16297. {
  16298. return $this->dev;
  16299. }
  16300. public function getRequires()
  16301. {
  16302. return $this->requires;
  16303. }
  16304. public function getConflicts()
  16305. {
  16306. return $this->conflicts;
  16307. }
  16308. public function getProvides()
  16309. {
  16310. return $this->provides;
  16311. }
  16312. public function getReplaces()
  16313. {
  16314. return $this->replaces;
  16315. }
  16316. public function getDevRequires()
  16317. {
  16318. return $this->devRequires;
  16319. }
  16320. public function setRootPackageAlias($value)
  16321. {
  16322. return $this->rootPackageAlias = $value;
  16323. }
  16324. public function isRootPackageAlias()
  16325. {
  16326. return $this->rootPackageAlias;
  16327. }
  16328. protected function replaceSelfVersionDependencies(array $links, $linkType)
  16329. {
  16330. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  16331. $newLinks = array();
  16332. foreach ($links as $link) {
  16333. if ('self.version' === $link->getPrettyConstraint()) {
  16334. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16335. }
  16336. }
  16337. $links = array_merge($links, $newLinks);
  16338. } else {
  16339. foreach ($links as $index => $link) {
  16340. if ('self.version' === $link->getPrettyConstraint()) {
  16341. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16342. }
  16343. }
  16344. }
  16345. return $links;
  16346. }
  16347. public function getType()
  16348. {
  16349. return $this->aliasOf->getType();
  16350. }
  16351. public function getTargetDir()
  16352. {
  16353. return $this->aliasOf->getTargetDir();
  16354. }
  16355. public function getExtra()
  16356. {
  16357. return $this->aliasOf->getExtra();
  16358. }
  16359. public function setInstallationSource($type)
  16360. {
  16361. $this->aliasOf->setInstallationSource($type);
  16362. }
  16363. public function getInstallationSource()
  16364. {
  16365. return $this->aliasOf->getInstallationSource();
  16366. }
  16367. public function getSourceType()
  16368. {
  16369. return $this->aliasOf->getSourceType();
  16370. }
  16371. public function getSourceUrl()
  16372. {
  16373. return $this->aliasOf->getSourceUrl();
  16374. }
  16375. public function getSourceUrls()
  16376. {
  16377. return $this->aliasOf->getSourceUrls();
  16378. }
  16379. public function getSourceReference()
  16380. {
  16381. return $this->aliasOf->getSourceReference();
  16382. }
  16383. public function setSourceReference($reference)
  16384. {
  16385. return $this->aliasOf->setSourceReference($reference);
  16386. }
  16387. public function setSourceMirrors($mirrors)
  16388. {
  16389. return $this->aliasOf->setSourceMirrors($mirrors);
  16390. }
  16391. public function getSourceMirrors()
  16392. {
  16393. return $this->aliasOf->getSourceMirrors();
  16394. }
  16395. public function getDistType()
  16396. {
  16397. return $this->aliasOf->getDistType();
  16398. }
  16399. public function getDistUrl()
  16400. {
  16401. return $this->aliasOf->getDistUrl();
  16402. }
  16403. public function getDistUrls()
  16404. {
  16405. return $this->aliasOf->getDistUrls();
  16406. }
  16407. public function getDistReference()
  16408. {
  16409. return $this->aliasOf->getDistReference();
  16410. }
  16411. public function setDistReference($reference)
  16412. {
  16413. return $this->aliasOf->setDistReference($reference);
  16414. }
  16415. public function getDistSha1Checksum()
  16416. {
  16417. return $this->aliasOf->getDistSha1Checksum();
  16418. }
  16419. public function setTransportOptions(array $options)
  16420. {
  16421. return $this->aliasOf->setTransportOptions($options);
  16422. }
  16423. public function getTransportOptions()
  16424. {
  16425. return $this->aliasOf->getTransportOptions();
  16426. }
  16427. public function setDistMirrors($mirrors)
  16428. {
  16429. return $this->aliasOf->setDistMirrors($mirrors);
  16430. }
  16431. public function getDistMirrors()
  16432. {
  16433. return $this->aliasOf->getDistMirrors();
  16434. }
  16435. public function getScripts()
  16436. {
  16437. return $this->aliasOf->getScripts();
  16438. }
  16439. public function getLicense()
  16440. {
  16441. return $this->aliasOf->getLicense();
  16442. }
  16443. public function getAutoload()
  16444. {
  16445. return $this->aliasOf->getAutoload();
  16446. }
  16447. public function getDevAutoload()
  16448. {
  16449. return $this->aliasOf->getDevAutoload();
  16450. }
  16451. public function getIncludePaths()
  16452. {
  16453. return $this->aliasOf->getIncludePaths();
  16454. }
  16455. public function getRepositories()
  16456. {
  16457. return $this->aliasOf->getRepositories();
  16458. }
  16459. public function getReleaseDate()
  16460. {
  16461. return $this->aliasOf->getReleaseDate();
  16462. }
  16463. public function getBinaries()
  16464. {
  16465. return $this->aliasOf->getBinaries();
  16466. }
  16467. public function getKeywords()
  16468. {
  16469. return $this->aliasOf->getKeywords();
  16470. }
  16471. public function getDescription()
  16472. {
  16473. return $this->aliasOf->getDescription();
  16474. }
  16475. public function getHomepage()
  16476. {
  16477. return $this->aliasOf->getHomepage();
  16478. }
  16479. public function getSuggests()
  16480. {
  16481. return $this->aliasOf->getSuggests();
  16482. }
  16483. public function getAuthors()
  16484. {
  16485. return $this->aliasOf->getAuthors();
  16486. }
  16487. public function getSupport()
  16488. {
  16489. return $this->aliasOf->getSupport();
  16490. }
  16491. public function getNotificationUrl()
  16492. {
  16493. return $this->aliasOf->getNotificationUrl();
  16494. }
  16495. public function getArchiveExcludes()
  16496. {
  16497. return $this->aliasOf->getArchiveExcludes();
  16498. }
  16499. public function isAbandoned()
  16500. {
  16501. return $this->aliasOf->isAbandoned();
  16502. }
  16503. public function getReplacementPackage()
  16504. {
  16505. return $this->aliasOf->getReplacementPackage();
  16506. }
  16507. public function __toString()
  16508. {
  16509. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16510. }
  16511. public function setDistUrl($url)
  16512. {
  16513. return $this->aliasOf->setDistUrl($url);
  16514. }
  16515. public function setDistType($type)
  16516. {
  16517. return $this->aliasOf->setDistType($type);
  16518. }
  16519. }
  16520. <?php
  16521. namespace Composer\Package\Archiver;
  16522. use FilterIterator;
  16523. use PharData;
  16524. class ArchivableFilesFilter extends FilterIterator
  16525. {
  16526. private $dirs = array();
  16527. public function accept()
  16528. {
  16529. $file = $this->getInnerIterator()->current();
  16530. if ($file->isDir()) {
  16531. $this->dirs[] = (string) $file;
  16532. return false;
  16533. }
  16534. return true;
  16535. }
  16536. public function addEmptyDir(PharData $phar, $sources)
  16537. {
  16538. foreach ($this->dirs as $filepath) {
  16539. $localname = str_replace($sources . "/", '', $filepath);
  16540. $phar->addEmptyDir($localname);
  16541. }
  16542. }
  16543. }
  16544. <?php
  16545. namespace Composer\Package\Archiver;
  16546. use Composer\Util\Filesystem;
  16547. use FilesystemIterator;
  16548. use Symfony\Component\Finder\Finder;
  16549. use Symfony\Component\Finder\SplFileInfo;
  16550. class ArchivableFilesFinder extends \FilterIterator
  16551. {
  16552. protected $finder;
  16553. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16554. {
  16555. $fs = new Filesystem();
  16556. $sources = $fs->normalizePath($sources);
  16557. if ($ignoreFilters) {
  16558. $filters = array();
  16559. } else {
  16560. $filters = array(
  16561. new HgExcludeFilter($sources),
  16562. new GitExcludeFilter($sources),
  16563. new ComposerExcludeFilter($sources, $excludes),
  16564. );
  16565. }
  16566. $this->finder = new Finder();
  16567. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16568. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16569. return false;
  16570. }
  16571. $relativePath = preg_replace(
  16572. '#^'.preg_quote($sources, '#').'#',
  16573. '',
  16574. $fs->normalizePath($file->getRealPath())
  16575. );
  16576. $exclude = false;
  16577. foreach ($filters as $filter) {
  16578. $exclude = $filter->filter($relativePath, $exclude);
  16579. }
  16580. return !$exclude;
  16581. };
  16582. if (method_exists($filter, 'bindTo')) {
  16583. $filter = $filter->bindTo(null);
  16584. }
  16585. $this->finder
  16586. ->in($sources)
  16587. ->filter($filter)
  16588. ->ignoreVCS(true)
  16589. ->ignoreDotFiles(false);
  16590. parent::__construct($this->finder->getIterator());
  16591. }
  16592. public function accept()
  16593. {
  16594. $current = $this->getInnerIterator()->current();
  16595. if (!$current->isDir()) {
  16596. return true;
  16597. }
  16598. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16599. return !$iterator->valid();
  16600. }
  16601. }
  16602. <?php
  16603. namespace Composer\Package\Archiver;
  16604. use Composer\Downloader\DownloadManager;
  16605. use Composer\Package\PackageInterface;
  16606. use Composer\Package\RootPackageInterface;
  16607. use Composer\Util\Filesystem;
  16608. use Composer\Json\JsonFile;
  16609. class ArchiveManager
  16610. {
  16611. protected $downloadManager;
  16612. protected $archivers = array();
  16613. protected $overwriteFiles = true;
  16614. public function __construct(DownloadManager $downloadManager)
  16615. {
  16616. $this->downloadManager = $downloadManager;
  16617. }
  16618. public function addArchiver(ArchiverInterface $archiver)
  16619. {
  16620. $this->archivers[] = $archiver;
  16621. }
  16622. public function setOverwriteFiles($overwriteFiles)
  16623. {
  16624. $this->overwriteFiles = $overwriteFiles;
  16625. return $this;
  16626. }
  16627. public function getPackageFilename(PackageInterface $package)
  16628. {
  16629. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16630. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16631. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16632. } else {
  16633. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16634. }
  16635. if ($package->getSourceReference()) {
  16636. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16637. }
  16638. $name = implode('-', array_filter($nameParts, function ($p) {
  16639. return !empty($p);
  16640. }));
  16641. return str_replace('/', '-', $name);
  16642. }
  16643. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16644. {
  16645. if (empty($format)) {
  16646. throw new \InvalidArgumentException('Format must be specified');
  16647. }
  16648. $usableArchiver = null;
  16649. foreach ($this->archivers as $archiver) {
  16650. if ($archiver->supports($format, $package->getSourceType())) {
  16651. $usableArchiver = $archiver;
  16652. break;
  16653. }
  16654. }
  16655. if (null === $usableArchiver) {
  16656. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16657. }
  16658. $filesystem = new Filesystem();
  16659. if (null === $fileName) {
  16660. $packageName = $this->getPackageFilename($package);
  16661. } else {
  16662. $packageName = $fileName;
  16663. }
  16664. $filesystem->ensureDirectoryExists($targetDir);
  16665. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16666. $filesystem->ensureDirectoryExists(dirname($target));
  16667. if (!$this->overwriteFiles && file_exists($target)) {
  16668. return $target;
  16669. }
  16670. if ($package instanceof RootPackageInterface) {
  16671. $sourcePath = realpath('.');
  16672. } else {
  16673. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16674. $filesystem->ensureDirectoryExists($sourcePath);
  16675. try {
  16676. $this->downloadManager->download($package, $sourcePath);
  16677. } catch (\Exception $e) {
  16678. $filesystem->removeDirectory($sourcePath);
  16679. throw $e;
  16680. }
  16681. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16682. $jsonFile = new JsonFile($composerJsonPath);
  16683. $jsonData = $jsonFile->read();
  16684. if (!empty($jsonData['archive']['exclude'])) {
  16685. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16686. }
  16687. }
  16688. }
  16689. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16690. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16691. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16692. $filesystem->rename($archivePath, $target);
  16693. if (!$package instanceof RootPackageInterface) {
  16694. $filesystem->removeDirectory($sourcePath);
  16695. }
  16696. $filesystem->remove($tempTarget);
  16697. return $target;
  16698. }
  16699. }
  16700. <?php
  16701. namespace Composer\Package\Archiver;
  16702. interface ArchiverInterface
  16703. {
  16704. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16705. public function supports($format, $sourceType);
  16706. }
  16707. <?php
  16708. namespace Composer\Package\Archiver;
  16709. use Symfony\Component\Finder;
  16710. abstract class BaseExcludeFilter
  16711. {
  16712. protected $sourcePath;
  16713. protected $excludePatterns;
  16714. public function __construct($sourcePath)
  16715. {
  16716. $this->sourcePath = $sourcePath;
  16717. $this->excludePatterns = array();
  16718. }
  16719. public function filter($relativePath, $exclude)
  16720. {
  16721. foreach ($this->excludePatterns as $patternData) {
  16722. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16723. if ($stripLeadingSlash) {
  16724. $path = substr($relativePath, 1);
  16725. } else {
  16726. $path = $relativePath;
  16727. }
  16728. if (preg_match($pattern, $path)) {
  16729. $exclude = !$negate;
  16730. }
  16731. }
  16732. return $exclude;
  16733. }
  16734. protected function parseLines(array $lines, $lineParser)
  16735. {
  16736. return array_filter(
  16737. array_map(
  16738. function ($line) use ($lineParser) {
  16739. $line = trim($line);
  16740. if (!$line || 0 === strpos($line, '#')) {
  16741. return null;
  16742. }
  16743. return call_user_func($lineParser, $line);
  16744. },
  16745. $lines
  16746. ),
  16747. function ($pattern) {
  16748. return $pattern !== null;
  16749. }
  16750. );
  16751. }
  16752. protected function generatePatterns($rules)
  16753. {
  16754. $patterns = array();
  16755. foreach ($rules as $rule) {
  16756. $patterns[] = $this->generatePattern($rule);
  16757. }
  16758. return $patterns;
  16759. }
  16760. protected function generatePattern($rule)
  16761. {
  16762. $negate = false;
  16763. $pattern = '{';
  16764. if (strlen($rule) && $rule[0] === '!') {
  16765. $negate = true;
  16766. $rule = substr($rule, 1);
  16767. }
  16768. if (strlen($rule) && $rule[0] === '/') {
  16769. $pattern .= '^/';
  16770. $rule = substr($rule, 1);
  16771. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16772. $pattern .= '/';
  16773. $rule = substr($rule, 0, -1);
  16774. } elseif (false === strpos($rule, '/')) {
  16775. $pattern .= '/';
  16776. }
  16777. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16778. return array($pattern . '}', $negate, false);
  16779. }
  16780. }
  16781. <?php
  16782. namespace Composer\Package\Archiver;
  16783. class ComposerExcludeFilter extends BaseExcludeFilter
  16784. {
  16785. public function __construct($sourcePath, array $excludeRules)
  16786. {
  16787. parent::__construct($sourcePath);
  16788. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16789. }
  16790. }
  16791. <?php
  16792. namespace Composer\Package\Archiver;
  16793. class GitExcludeFilter extends BaseExcludeFilter
  16794. {
  16795. public function __construct($sourcePath)
  16796. {
  16797. parent::__construct($sourcePath);
  16798. if (file_exists($sourcePath.'/.gitignore')) {
  16799. $this->excludePatterns = $this->parseLines(
  16800. file($sourcePath.'/.gitignore'),
  16801. array($this, 'parseGitIgnoreLine')
  16802. );
  16803. }
  16804. if (file_exists($sourcePath.'/.gitattributes')) {
  16805. $this->excludePatterns = array_merge(
  16806. $this->excludePatterns,
  16807. $this->parseLines(
  16808. file($sourcePath.'/.gitattributes'),
  16809. array($this, 'parseGitAttributesLine')
  16810. )
  16811. );
  16812. }
  16813. }
  16814. public function parseGitIgnoreLine($line)
  16815. {
  16816. return $this->generatePattern($line);
  16817. }
  16818. public function parseGitAttributesLine($line)
  16819. {
  16820. $parts = preg_split('#\s+#', $line);
  16821. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16822. return $this->generatePattern($parts[0]);
  16823. }
  16824. return null;
  16825. }
  16826. }
  16827. <?php
  16828. namespace Composer\Package\Archiver;
  16829. use Symfony\Component\Finder;
  16830. class HgExcludeFilter extends BaseExcludeFilter
  16831. {
  16832. const HG_IGNORE_REGEX = 1;
  16833. const HG_IGNORE_GLOB = 2;
  16834. protected $patternMode;
  16835. public function __construct($sourcePath)
  16836. {
  16837. parent::__construct($sourcePath);
  16838. $this->patternMode = self::HG_IGNORE_REGEX;
  16839. if (file_exists($sourcePath.'/.hgignore')) {
  16840. $this->excludePatterns = $this->parseLines(
  16841. file($sourcePath.'/.hgignore'),
  16842. array($this, 'parseHgIgnoreLine')
  16843. );
  16844. }
  16845. }
  16846. public function parseHgIgnoreLine($line)
  16847. {
  16848. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16849. if ($matches[1] === 'glob') {
  16850. $this->patternMode = self::HG_IGNORE_GLOB;
  16851. } else {
  16852. $this->patternMode = self::HG_IGNORE_REGEX;
  16853. }
  16854. return null;
  16855. }
  16856. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16857. return $this->patternFromGlob($line);
  16858. }
  16859. return $this->patternFromRegex($line);
  16860. }
  16861. protected function patternFromGlob($line)
  16862. {
  16863. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16864. $pattern = str_replace('[^/]*', '.*', $pattern);
  16865. return array($pattern, false, true);
  16866. }
  16867. public function patternFromRegex($line)
  16868. {
  16869. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16870. return array($pattern, false, true);
  16871. }
  16872. }
  16873. <?php
  16874. namespace Composer\Package\Archiver;
  16875. class PharArchiver implements ArchiverInterface
  16876. {
  16877. protected static $formats = array(
  16878. 'zip' => \Phar::ZIP,
  16879. 'tar' => \Phar::TAR,
  16880. 'tar.gz' => \Phar::TAR,
  16881. 'tar.bz2' => \Phar::TAR,
  16882. );
  16883. protected static $compressFormats = array(
  16884. 'tar.gz' => \Phar::GZ,
  16885. 'tar.bz2' => \Phar::BZ2,
  16886. );
  16887. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16888. {
  16889. $sources = realpath($sources);
  16890. if (file_exists($target)) {
  16891. unlink($target);
  16892. }
  16893. try {
  16894. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16895. if (isset(static::$compressFormats[$format])) {
  16896. $target = $filename . '.tar';
  16897. }
  16898. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16899. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16900. $filesOnly = new ArchivableFilesFilter($files);
  16901. $phar->buildFromIterator($filesOnly, $sources);
  16902. $filesOnly->addEmptyDir($phar, $sources);
  16903. if (isset(static::$compressFormats[$format])) {
  16904. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16905. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16906. }
  16907. unlink($target);
  16908. $phar->compress(static::$compressFormats[$format]);
  16909. $target = $filename . '.' . $format;
  16910. }
  16911. return $target;
  16912. } catch (\UnexpectedValueException $e) {
  16913. $message = sprintf(
  16914. "Could not create archive '%s' from '%s': %s",
  16915. $target,
  16916. $sources,
  16917. $e->getMessage()
  16918. );
  16919. throw new \RuntimeException($message, $e->getCode(), $e);
  16920. }
  16921. }
  16922. public function supports($format, $sourceType)
  16923. {
  16924. return isset(static::$formats[$format]);
  16925. }
  16926. }
  16927. <?php
  16928. namespace Composer\Package\Archiver;
  16929. use ZipArchive;
  16930. use Composer\Util\Filesystem;
  16931. class ZipArchiver implements ArchiverInterface
  16932. {
  16933. protected static $formats = array(
  16934. 'zip' => 1,
  16935. );
  16936. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16937. {
  16938. $fs = new Filesystem();
  16939. $sources = $fs->normalizePath($sources);
  16940. $zip = new ZipArchive();
  16941. $res = $zip->open($target, ZipArchive::CREATE);
  16942. if ($res === true) {
  16943. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16944. foreach ($files as $file) {
  16945. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16946. $localname = str_replace($sources.'/', '', $filepath);
  16947. if ($file->isDir()) {
  16948. $zip->addEmptyDir($localname);
  16949. } else {
  16950. $zip->addFile($filepath, $localname);
  16951. }
  16952. }
  16953. if ($zip->close()) {
  16954. return $target;
  16955. }
  16956. }
  16957. $message = sprintf(
  16958. "Could not create archive '%s' from '%s': %s",
  16959. $target,
  16960. $sources,
  16961. $zip->getStatusString()
  16962. );
  16963. throw new \RuntimeException($message);
  16964. }
  16965. public function supports($format, $sourceType)
  16966. {
  16967. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16968. }
  16969. private function compressionAvailable()
  16970. {
  16971. return class_exists('ZipArchive');
  16972. }
  16973. }
  16974. <?php
  16975. namespace Composer\Package;
  16976. use Composer\Repository\RepositoryInterface;
  16977. use Composer\Repository\PlatformRepository;
  16978. abstract class BasePackage implements PackageInterface
  16979. {
  16980. public static $supportedLinkTypes = array(
  16981. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16982. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16983. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16984. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16985. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16986. );
  16987. const STABILITY_STABLE = 0;
  16988. const STABILITY_RC = 5;
  16989. const STABILITY_BETA = 10;
  16990. const STABILITY_ALPHA = 15;
  16991. const STABILITY_DEV = 20;
  16992. public static $stabilities = array(
  16993. 'stable' => self::STABILITY_STABLE,
  16994. 'RC' => self::STABILITY_RC,
  16995. 'beta' => self::STABILITY_BETA,
  16996. 'alpha' => self::STABILITY_ALPHA,
  16997. 'dev' => self::STABILITY_DEV,
  16998. );
  16999. public $id;
  17000. protected $name;
  17001. protected $prettyName;
  17002. protected $repository;
  17003. protected $transportOptions = array();
  17004. public function __construct($name)
  17005. {
  17006. $this->prettyName = $name;
  17007. $this->name = strtolower($name);
  17008. $this->id = -1;
  17009. }
  17010. public function getName()
  17011. {
  17012. return $this->name;
  17013. }
  17014. public function getPrettyName()
  17015. {
  17016. return $this->prettyName;
  17017. }
  17018. public function getNames()
  17019. {
  17020. $names = array(
  17021. $this->getName() => true,
  17022. );
  17023. foreach ($this->getProvides() as $link) {
  17024. $names[$link->getTarget()] = true;
  17025. }
  17026. foreach ($this->getReplaces() as $link) {
  17027. $names[$link->getTarget()] = true;
  17028. }
  17029. return array_keys($names);
  17030. }
  17031. public function setId($id)
  17032. {
  17033. $this->id = $id;
  17034. }
  17035. public function getId()
  17036. {
  17037. return $this->id;
  17038. }
  17039. public function setRepository(RepositoryInterface $repository)
  17040. {
  17041. if ($this->repository && $repository !== $this->repository) {
  17042. throw new \LogicException('A package can only be added to one repository');
  17043. }
  17044. $this->repository = $repository;
  17045. }
  17046. public function getRepository()
  17047. {
  17048. return $this->repository;
  17049. }
  17050. public function getTransportOptions()
  17051. {
  17052. return $this->transportOptions;
  17053. }
  17054. public function setTransportOptions(array $options)
  17055. {
  17056. $this->transportOptions = $options;
  17057. }
  17058. public function isPlatform()
  17059. {
  17060. return $this->getRepository() instanceof PlatformRepository;
  17061. }
  17062. public function getUniqueName()
  17063. {
  17064. return $this->getName().'-'.$this->getVersion();
  17065. }
  17066. public function equals(PackageInterface $package)
  17067. {
  17068. $self = $this;
  17069. if ($this instanceof AliasPackage) {
  17070. $self = $this->getAliasOf();
  17071. }
  17072. if ($package instanceof AliasPackage) {
  17073. $package = $package->getAliasOf();
  17074. }
  17075. return $package === $self;
  17076. }
  17077. public function __toString()
  17078. {
  17079. return $this->getUniqueName();
  17080. }
  17081. public function getPrettyString()
  17082. {
  17083. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17084. }
  17085. public function getFullPrettyVersion($truncate = true)
  17086. {
  17087. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17088. return $this->getPrettyVersion();
  17089. }
  17090. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17091. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17092. }
  17093. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17094. }
  17095. public function getStabilityPriority()
  17096. {
  17097. return self::$stabilities[$this->getStability()];
  17098. }
  17099. public function __clone()
  17100. {
  17101. $this->repository = null;
  17102. $this->id = -1;
  17103. }
  17104. public static function packageNameToRegexp($whiteListedPattern, $wrap = '{^%s$}i')
  17105. {
  17106. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  17107. return sprintf($wrap, $cleanedWhiteListedPattern);
  17108. }
  17109. }
  17110. <?php
  17111. namespace Composer\Package\Comparer;
  17112. class Comparer
  17113. {
  17114. private $source;
  17115. private $update;
  17116. private $changed;
  17117. public function setSource($source)
  17118. {
  17119. $this->source = $source;
  17120. }
  17121. public function setUpdate($update)
  17122. {
  17123. $this->update = $update;
  17124. }
  17125. public function getChanged($toString = false, $explicated = false)
  17126. {
  17127. $changed = $this->changed;
  17128. if (!count($changed)) {
  17129. return false;
  17130. }
  17131. if ($explicated) {
  17132. foreach ($changed as $sectionKey => $itemSection) {
  17133. foreach ($itemSection as $itemKey => $item) {
  17134. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17135. }
  17136. }
  17137. }
  17138. if ($toString) {
  17139. foreach ($changed as $sectionKey => $itemSection) {
  17140. foreach ($itemSection as $itemKey => $item) {
  17141. $changed['string'][] = $item."\r\n";
  17142. }
  17143. }
  17144. $changed = implode("\r\n", $changed['string']);
  17145. }
  17146. return $changed;
  17147. }
  17148. public function doCompare()
  17149. {
  17150. $source = array();
  17151. $destination = array();
  17152. $this->changed = array();
  17153. $currentDirectory = getcwd();
  17154. chdir($this->source);
  17155. $source = $this->doTree('.', $source);
  17156. if (!is_array($source)) {
  17157. return;
  17158. }
  17159. chdir($currentDirectory);
  17160. chdir($this->update);
  17161. $destination = $this->doTree('.', $destination);
  17162. if (!is_array($destination)) {
  17163. exit;
  17164. }
  17165. chdir($currentDirectory);
  17166. foreach ($source as $dir => $value) {
  17167. foreach ($value as $file => $hash) {
  17168. if (isset($destination[$dir][$file])) {
  17169. if ($hash !== $destination[$dir][$file]) {
  17170. $this->changed['changed'][] = $dir.'/'.$file;
  17171. }
  17172. } else {
  17173. $this->changed['removed'][] = $dir.'/'.$file;
  17174. }
  17175. }
  17176. }
  17177. foreach ($destination as $dir => $value) {
  17178. foreach ($value as $file => $hash) {
  17179. if (!isset($source[$dir][$file])) {
  17180. $this->changed['added'][] = $dir.'/'.$file;
  17181. }
  17182. }
  17183. }
  17184. }
  17185. private function doTree($dir, &$array)
  17186. {
  17187. if ($dh = opendir($dir)) {
  17188. while ($file = readdir($dh)) {
  17189. if ($file !== '.' && $file !== '..') {
  17190. if (is_dir($dir.'/'.$file)) {
  17191. if (!count($array)) {
  17192. $array[0] = 'Temp';
  17193. }
  17194. if (!$this->doTree($dir.'/'.$file, $array)) {
  17195. return false;
  17196. }
  17197. } else {
  17198. if (filesize($dir.'/'.$file)) {
  17199. set_time_limit(30);
  17200. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17201. }
  17202. }
  17203. }
  17204. }
  17205. if (count($array) > 1 && isset($array['0'])) {
  17206. unset($array['0']);
  17207. }
  17208. return $array;
  17209. }
  17210. return false;
  17211. }
  17212. }
  17213. <?php
  17214. namespace Composer\Package;
  17215. class CompletePackage extends Package implements CompletePackageInterface
  17216. {
  17217. protected $repositories;
  17218. protected $license = array();
  17219. protected $keywords;
  17220. protected $authors;
  17221. protected $description;
  17222. protected $homepage;
  17223. protected $scripts = array();
  17224. protected $support = array();
  17225. protected $abandoned = false;
  17226. public function setScripts(array $scripts)
  17227. {
  17228. $this->scripts = $scripts;
  17229. }
  17230. public function getScripts()
  17231. {
  17232. return $this->scripts;
  17233. }
  17234. public function setRepositories($repositories)
  17235. {
  17236. $this->repositories = $repositories;
  17237. }
  17238. public function getRepositories()
  17239. {
  17240. return $this->repositories;
  17241. }
  17242. public function setLicense(array $license)
  17243. {
  17244. $this->license = $license;
  17245. }
  17246. public function getLicense()
  17247. {
  17248. return $this->license;
  17249. }
  17250. public function setKeywords(array $keywords)
  17251. {
  17252. $this->keywords = $keywords;
  17253. }
  17254. public function getKeywords()
  17255. {
  17256. return $this->keywords;
  17257. }
  17258. public function setAuthors(array $authors)
  17259. {
  17260. $this->authors = $authors;
  17261. }
  17262. public function getAuthors()
  17263. {
  17264. return $this->authors;
  17265. }
  17266. public function setDescription($description)
  17267. {
  17268. $this->description = $description;
  17269. }
  17270. public function getDescription()
  17271. {
  17272. return $this->description;
  17273. }
  17274. public function setHomepage($homepage)
  17275. {
  17276. $this->homepage = $homepage;
  17277. }
  17278. public function getHomepage()
  17279. {
  17280. return $this->homepage;
  17281. }
  17282. public function setSupport(array $support)
  17283. {
  17284. $this->support = $support;
  17285. }
  17286. public function getSupport()
  17287. {
  17288. return $this->support;
  17289. }
  17290. public function isAbandoned()
  17291. {
  17292. return (bool) $this->abandoned;
  17293. }
  17294. public function setAbandoned($abandoned)
  17295. {
  17296. $this->abandoned = $abandoned;
  17297. }
  17298. public function getReplacementPackage()
  17299. {
  17300. return is_string($this->abandoned) ? $this->abandoned : null;
  17301. }
  17302. }
  17303. <?php
  17304. namespace Composer\Package;
  17305. interface CompletePackageInterface extends PackageInterface
  17306. {
  17307. public function getScripts();
  17308. public function getRepositories();
  17309. public function getLicense();
  17310. public function getKeywords();
  17311. public function getDescription();
  17312. public function getHomepage();
  17313. public function getAuthors();
  17314. public function getSupport();
  17315. public function isAbandoned();
  17316. public function getReplacementPackage();
  17317. }
  17318. <?php
  17319. namespace Composer\Package\Dumper;
  17320. use Composer\Package\BasePackage;
  17321. use Composer\Package\PackageInterface;
  17322. use Composer\Package\CompletePackageInterface;
  17323. use Composer\Package\RootPackageInterface;
  17324. class ArrayDumper
  17325. {
  17326. public function dump(PackageInterface $package)
  17327. {
  17328. $keys = array(
  17329. 'binaries' => 'bin',
  17330. 'type',
  17331. 'extra',
  17332. 'installationSource' => 'installation-source',
  17333. 'autoload',
  17334. 'devAutoload' => 'autoload-dev',
  17335. 'notificationUrl' => 'notification-url',
  17336. 'includePaths' => 'include-path',
  17337. );
  17338. $data = array();
  17339. $data['name'] = $package->getPrettyName();
  17340. $data['version'] = $package->getPrettyVersion();
  17341. $data['version_normalized'] = $package->getVersion();
  17342. if ($package->getTargetDir()) {
  17343. $data['target-dir'] = $package->getTargetDir();
  17344. }
  17345. if ($package->getSourceType()) {
  17346. $data['source']['type'] = $package->getSourceType();
  17347. $data['source']['url'] = $package->getSourceUrl();
  17348. if (null !== ($value = $package->getSourceReference())) {
  17349. $data['source']['reference'] = $value;
  17350. }
  17351. if ($mirrors = $package->getSourceMirrors()) {
  17352. $data['source']['mirrors'] = $mirrors;
  17353. }
  17354. }
  17355. if ($package->getDistType()) {
  17356. $data['dist']['type'] = $package->getDistType();
  17357. $data['dist']['url'] = $package->getDistUrl();
  17358. if (null !== ($value = $package->getDistReference())) {
  17359. $data['dist']['reference'] = $value;
  17360. }
  17361. if (null !== ($value = $package->getDistSha1Checksum())) {
  17362. $data['dist']['shasum'] = $value;
  17363. }
  17364. if ($mirrors = $package->getDistMirrors()) {
  17365. $data['dist']['mirrors'] = $mirrors;
  17366. }
  17367. }
  17368. if ($package->getArchiveExcludes()) {
  17369. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17370. }
  17371. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17372. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17373. foreach ($links as $link) {
  17374. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17375. }
  17376. ksort($data[$type]);
  17377. }
  17378. }
  17379. if ($packages = $package->getSuggests()) {
  17380. ksort($packages);
  17381. $data['suggest'] = $packages;
  17382. }
  17383. if ($package->getReleaseDate()) {
  17384. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17385. }
  17386. $data = $this->dumpValues($package, $keys, $data);
  17387. if ($package instanceof CompletePackageInterface) {
  17388. $keys = array(
  17389. 'scripts',
  17390. 'license',
  17391. 'authors',
  17392. 'description',
  17393. 'homepage',
  17394. 'keywords',
  17395. 'repositories',
  17396. 'support',
  17397. );
  17398. $data = $this->dumpValues($package, $keys, $data);
  17399. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17400. sort($data['keywords']);
  17401. }
  17402. if ($package->isAbandoned()) {
  17403. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17404. }
  17405. }
  17406. if ($package instanceof RootPackageInterface) {
  17407. $minimumStability = $package->getMinimumStability();
  17408. if ($minimumStability) {
  17409. $data['minimum-stability'] = $minimumStability;
  17410. }
  17411. }
  17412. if (count($package->getTransportOptions()) > 0) {
  17413. $data['transport-options'] = $package->getTransportOptions();
  17414. }
  17415. return $data;
  17416. }
  17417. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17418. {
  17419. foreach ($keys as $method => $key) {
  17420. if (is_numeric($method)) {
  17421. $method = $key;
  17422. }
  17423. $getter = 'get'.ucfirst($method);
  17424. $value = $package->$getter();
  17425. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17426. $data[$key] = $value;
  17427. }
  17428. }
  17429. return $data;
  17430. }
  17431. }
  17432. <?php
  17433. namespace Composer\Package;
  17434. use Composer\Semver\Constraint\ConstraintInterface;
  17435. class Link
  17436. {
  17437. protected $source;
  17438. protected $target;
  17439. protected $constraint;
  17440. protected $description;
  17441. protected $prettyConstraint;
  17442. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17443. {
  17444. $this->source = strtolower($source);
  17445. $this->target = strtolower($target);
  17446. $this->constraint = $constraint;
  17447. $this->description = $description;
  17448. $this->prettyConstraint = $prettyConstraint;
  17449. }
  17450. public function getDescription()
  17451. {
  17452. return $this->description;
  17453. }
  17454. public function getSource()
  17455. {
  17456. return $this->source;
  17457. }
  17458. public function getTarget()
  17459. {
  17460. return $this->target;
  17461. }
  17462. public function getConstraint()
  17463. {
  17464. return $this->constraint;
  17465. }
  17466. public function getPrettyConstraint()
  17467. {
  17468. if (null === $this->prettyConstraint) {
  17469. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17470. }
  17471. return $this->prettyConstraint;
  17472. }
  17473. public function __toString()
  17474. {
  17475. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17476. }
  17477. public function getPrettyString(PackageInterface $sourcePackage)
  17478. {
  17479. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17480. }
  17481. }
  17482. <?php
  17483. namespace Composer\Package\LinkConstraint;
  17484. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17485. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17486. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17487. {
  17488. }
  17489. <?php
  17490. namespace Composer\Package\LinkConstraint;
  17491. use Composer\Semver\Constraint\ConstraintInterface;
  17492. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17493. interface LinkConstraintInterface extends ConstraintInterface
  17494. {
  17495. }
  17496. <?php
  17497. namespace Composer\Package\LinkConstraint;
  17498. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17499. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17500. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17501. {
  17502. }
  17503. <?php
  17504. namespace Composer\Package\LinkConstraint;
  17505. use Composer\Semver\Constraint\AbstractConstraint;
  17506. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17507. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17508. {
  17509. }
  17510. <?php
  17511. namespace Composer\Package\LinkConstraint;
  17512. use Composer\Semver\Constraint\Constraint;
  17513. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17514. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17515. {
  17516. }
  17517. <?php
  17518. namespace Composer\Package\Loader;
  17519. use Composer\Package;
  17520. use Composer\Package\AliasPackage;
  17521. use Composer\Package\Link;
  17522. use Composer\Package\RootAliasPackage;
  17523. use Composer\Package\RootPackageInterface;
  17524. use Composer\Package\Version\VersionParser;
  17525. use Composer\Semver\VersionParser as SemverVersionParser;
  17526. class ArrayLoader implements LoaderInterface
  17527. {
  17528. protected $versionParser;
  17529. protected $loadOptions;
  17530. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17531. {
  17532. if (!$parser) {
  17533. $parser = new VersionParser;
  17534. }
  17535. $this->versionParser = $parser;
  17536. $this->loadOptions = $loadOptions;
  17537. }
  17538. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17539. {
  17540. if (!isset($config['name'])) {
  17541. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17542. }
  17543. if (!isset($config['version'])) {
  17544. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17545. }
  17546. if (isset($config['version_normalized'])) {
  17547. $version = $config['version_normalized'];
  17548. } else {
  17549. $version = $this->versionParser->normalize($config['version']);
  17550. }
  17551. $package = new $class($config['name'], $version, $config['version']);
  17552. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17553. if (isset($config['target-dir'])) {
  17554. $package->setTargetDir($config['target-dir']);
  17555. }
  17556. if (isset($config['extra']) && is_array($config['extra'])) {
  17557. $package->setExtra($config['extra']);
  17558. }
  17559. if (isset($config['bin'])) {
  17560. foreach ((array) $config['bin'] as $key => $bin) {
  17561. $config['bin'][$key] = ltrim($bin, '/');
  17562. }
  17563. $package->setBinaries((array) $config['bin']);
  17564. }
  17565. if (isset($config['installation-source'])) {
  17566. $package->setInstallationSource($config['installation-source']);
  17567. }
  17568. if (isset($config['source'])) {
  17569. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17570. throw new \UnexpectedValueException(sprintf(
  17571. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17572. $config['name'],
  17573. json_encode($config['source'])
  17574. ));
  17575. }
  17576. $package->setSourceType($config['source']['type']);
  17577. $package->setSourceUrl($config['source']['url']);
  17578. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  17579. if (isset($config['source']['mirrors'])) {
  17580. $package->setSourceMirrors($config['source']['mirrors']);
  17581. }
  17582. }
  17583. if (isset($config['dist'])) {
  17584. if (!isset($config['dist']['type'])
  17585. || !isset($config['dist']['url'])) {
  17586. throw new \UnexpectedValueException(sprintf(
  17587. "Package %s's dist key should be specified as ".
  17588. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17589. $config['name'],
  17590. json_encode($config['dist'])
  17591. ));
  17592. }
  17593. $package->setDistType($config['dist']['type']);
  17594. $package->setDistUrl($config['dist']['url']);
  17595. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17596. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17597. if (isset($config['dist']['mirrors'])) {
  17598. $package->setDistMirrors($config['dist']['mirrors']);
  17599. }
  17600. }
  17601. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17602. if (isset($config[$type])) {
  17603. $method = 'set'.ucfirst($opts['method']);
  17604. $package->{$method}(
  17605. $this->parseLinks(
  17606. $package->getName(),
  17607. $package->getPrettyVersion(),
  17608. $opts['description'],
  17609. $config[$type]
  17610. )
  17611. );
  17612. }
  17613. }
  17614. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17615. foreach ($config['suggest'] as $target => $reason) {
  17616. if ('self.version' === trim($reason)) {
  17617. $config['suggest'][$target] = $package->getPrettyVersion();
  17618. }
  17619. }
  17620. $package->setSuggests($config['suggest']);
  17621. }
  17622. if (isset($config['autoload'])) {
  17623. $package->setAutoload($config['autoload']);
  17624. }
  17625. if (isset($config['autoload-dev'])) {
  17626. $package->setDevAutoload($config['autoload-dev']);
  17627. }
  17628. if (isset($config['include-path'])) {
  17629. $package->setIncludePaths($config['include-path']);
  17630. }
  17631. if (!empty($config['time'])) {
  17632. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17633. try {
  17634. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17635. $package->setReleaseDate($date);
  17636. } catch (\Exception $e) {
  17637. }
  17638. }
  17639. if (!empty($config['notification-url'])) {
  17640. $package->setNotificationUrl($config['notification-url']);
  17641. }
  17642. if (!empty($config['archive']['exclude'])) {
  17643. $package->setArchiveExcludes($config['archive']['exclude']);
  17644. }
  17645. if ($package instanceof Package\CompletePackageInterface) {
  17646. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17647. foreach ($config['scripts'] as $event => $listeners) {
  17648. $config['scripts'][$event] = (array) $listeners;
  17649. }
  17650. if (isset($config['scripts']['composer'])) {
  17651. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17652. }
  17653. $package->setScripts($config['scripts']);
  17654. }
  17655. if (!empty($config['description']) && is_string($config['description'])) {
  17656. $package->setDescription($config['description']);
  17657. }
  17658. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17659. $package->setHomepage($config['homepage']);
  17660. }
  17661. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17662. $package->setKeywords($config['keywords']);
  17663. }
  17664. if (!empty($config['license'])) {
  17665. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17666. }
  17667. if (!empty($config['authors']) && is_array($config['authors'])) {
  17668. $package->setAuthors($config['authors']);
  17669. }
  17670. if (isset($config['support'])) {
  17671. $package->setSupport($config['support']);
  17672. }
  17673. if (isset($config['abandoned'])) {
  17674. $package->setAbandoned($config['abandoned']);
  17675. }
  17676. }
  17677. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17678. if ($package instanceof RootPackageInterface) {
  17679. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17680. } else {
  17681. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17682. }
  17683. }
  17684. if ($this->loadOptions && isset($config['transport-options'])) {
  17685. $package->setTransportOptions($config['transport-options']);
  17686. }
  17687. return $package;
  17688. }
  17689. public function parseLinks($source, $sourceVersion, $description, $links)
  17690. {
  17691. $res = array();
  17692. foreach ($links as $target => $constraint) {
  17693. if (!is_string($constraint)) {
  17694. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17695. }
  17696. if ('self.version' === $constraint) {
  17697. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17698. } else {
  17699. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17700. }
  17701. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17702. }
  17703. return $res;
  17704. }
  17705. public function getBranchAlias(array $config)
  17706. {
  17707. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17708. || !isset($config['extra']['branch-alias'])
  17709. || !is_array($config['extra']['branch-alias'])
  17710. ) {
  17711. return;
  17712. }
  17713. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17714. if ('-dev' !== substr($targetBranch, -4)) {
  17715. continue;
  17716. }
  17717. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17718. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17719. continue;
  17720. }
  17721. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17722. continue;
  17723. }
  17724. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17725. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17726. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17727. ) {
  17728. continue;
  17729. }
  17730. return $validatedTargetBranch;
  17731. }
  17732. }
  17733. }
  17734. <?php
  17735. namespace Composer\Package\Loader;
  17736. class InvalidPackageException extends \Exception
  17737. {
  17738. private $errors;
  17739. private $warnings;
  17740. private $data;
  17741. public function __construct(array $errors, array $warnings, array $data)
  17742. {
  17743. $this->errors = $errors;
  17744. $this->warnings = $warnings;
  17745. $this->data = $data;
  17746. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17747. }
  17748. public function getData()
  17749. {
  17750. return $this->data;
  17751. }
  17752. public function getErrors()
  17753. {
  17754. return $this->errors;
  17755. }
  17756. public function getWarnings()
  17757. {
  17758. return $this->warnings;
  17759. }
  17760. }
  17761. <?php
  17762. namespace Composer\Package\Loader;
  17763. use Composer\Json\JsonFile;
  17764. class JsonLoader
  17765. {
  17766. private $loader;
  17767. public function __construct(LoaderInterface $loader)
  17768. {
  17769. $this->loader = $loader;
  17770. }
  17771. public function load($json)
  17772. {
  17773. if ($json instanceof JsonFile) {
  17774. $config = $json->read();
  17775. } elseif (file_exists($json)) {
  17776. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17777. } elseif (is_string($json)) {
  17778. $config = JsonFile::parseJson($json);
  17779. }
  17780. return $this->loader->load($config);
  17781. }
  17782. }
  17783. <?php
  17784. namespace Composer\Package\Loader;
  17785. interface LoaderInterface
  17786. {
  17787. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17788. }
  17789. <?php
  17790. namespace Composer\Package\Loader;
  17791. use Composer\Package\BasePackage;
  17792. use Composer\Package\AliasPackage;
  17793. use Composer\Config;
  17794. use Composer\IO\IOInterface;
  17795. use Composer\Package\RootPackageInterface;
  17796. use Composer\Repository\RepositoryFactory;
  17797. use Composer\Package\Version\VersionGuesser;
  17798. use Composer\Package\Version\VersionParser;
  17799. use Composer\Repository\RepositoryManager;
  17800. use Composer\Util\ProcessExecutor;
  17801. class RootPackageLoader extends ArrayLoader
  17802. {
  17803. private $manager;
  17804. private $config;
  17805. private $versionGuesser;
  17806. private $io;
  17807. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  17808. {
  17809. parent::__construct($parser);
  17810. $this->manager = $manager;
  17811. $this->config = $config;
  17812. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17813. $this->io = $io;
  17814. }
  17815. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17816. {
  17817. if (!isset($config['name'])) {
  17818. $config['name'] = '__root__';
  17819. } elseif ($this->io) {
  17820. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  17821. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17822. }
  17823. }
  17824. $autoVersioned = false;
  17825. if (!isset($config['version'])) {
  17826. $commit = null;
  17827. if (getenv('COMPOSER_ROOT_VERSION')) {
  17828. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17829. } else {
  17830. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17831. if ($versionData) {
  17832. $config['version'] = $versionData['pretty_version'];
  17833. $config['version_normalized'] = $versionData['version'];
  17834. $commit = $versionData['commit'];
  17835. }
  17836. }
  17837. if (!isset($config['version'])) {
  17838. $config['version'] = '1.0.0';
  17839. $autoVersioned = true;
  17840. }
  17841. if ($commit) {
  17842. $config['source'] = array(
  17843. 'type' => '',
  17844. 'url' => '',
  17845. 'reference' => $commit,
  17846. );
  17847. $config['dist'] = array(
  17848. 'type' => '',
  17849. 'url' => '',
  17850. 'reference' => $commit,
  17851. );
  17852. }
  17853. }
  17854. $realPackage = $package = parent::load($config, $class);
  17855. if ($realPackage instanceof AliasPackage) {
  17856. $realPackage = $package->getAliasOf();
  17857. }
  17858. if ($autoVersioned) {
  17859. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17860. }
  17861. if (isset($config['minimum-stability'])) {
  17862. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17863. }
  17864. $aliases = array();
  17865. $stabilityFlags = array();
  17866. $references = array();
  17867. foreach (array('require', 'require-dev') as $linkType) {
  17868. if (isset($config[$linkType])) {
  17869. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17870. $method = 'get'.ucfirst($linkInfo['method']);
  17871. $links = array();
  17872. foreach ($realPackage->$method() as $link) {
  17873. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17874. }
  17875. $aliases = $this->extractAliases($links, $aliases);
  17876. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17877. $references = $this->extractReferences($links, $references);
  17878. }
  17879. }
  17880. if ($this->io) {
  17881. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17882. if (isset($config[$linkType])) {
  17883. foreach ($config[$linkType] as $linkName => $constraint) {
  17884. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  17885. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17886. }
  17887. }
  17888. }
  17889. }
  17890. }
  17891. if (isset($links[$config['name']])) {
  17892. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17893. 'Did you accidentally name your root package after an external package?', $config['name']));
  17894. }
  17895. $realPackage->setAliases($aliases);
  17896. $realPackage->setStabilityFlags($stabilityFlags);
  17897. $realPackage->setReferences($references);
  17898. if (isset($config['prefer-stable'])) {
  17899. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17900. }
  17901. if (isset($config['config'])) {
  17902. $realPackage->setConfig($config['config']);
  17903. }
  17904. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17905. foreach ($repos as $repo) {
  17906. $this->manager->addRepository($repo);
  17907. }
  17908. $realPackage->setRepositories($this->config->getRepositories());
  17909. return $package;
  17910. }
  17911. private function extractAliases(array $requires, array $aliases)
  17912. {
  17913. foreach ($requires as $reqName => $reqVersion) {
  17914. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17915. $aliases[] = array(
  17916. 'package' => strtolower($reqName),
  17917. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17918. 'alias' => $match[2],
  17919. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17920. );
  17921. }
  17922. }
  17923. return $aliases;
  17924. }
  17925. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17926. {
  17927. $stabilities = BasePackage::$stabilities;
  17928. $minimumStability = $stabilities[$minimumStability];
  17929. foreach ($requires as $reqName => $reqVersion) {
  17930. $constraints = array();
  17931. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17932. foreach ($orSplit as $orConstraint) {
  17933. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17934. foreach ($andSplit as $andConstraint) {
  17935. $constraints[] = $andConstraint;
  17936. }
  17937. }
  17938. $match = false;
  17939. foreach ($constraints as $constraint) {
  17940. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17941. $name = strtolower($reqName);
  17942. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17943. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17944. continue;
  17945. }
  17946. $stabilityFlags[$name] = $stability;
  17947. $match = true;
  17948. }
  17949. }
  17950. if ($match) {
  17951. continue;
  17952. }
  17953. foreach ($constraints as $constraint) {
  17954. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17955. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17956. $name = strtolower($reqName);
  17957. $stability = $stabilities[$stabilityName];
  17958. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17959. continue;
  17960. }
  17961. $stabilityFlags[$name] = $stability;
  17962. }
  17963. }
  17964. }
  17965. return $stabilityFlags;
  17966. }
  17967. private function extractReferences(array $requires, array $references)
  17968. {
  17969. foreach ($requires as $reqName => $reqVersion) {
  17970. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17971. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  17972. $name = strtolower($reqName);
  17973. $references[$name] = $match[1];
  17974. }
  17975. }
  17976. return $references;
  17977. }
  17978. }
  17979. <?php
  17980. namespace Composer\Package\Loader;
  17981. use Composer\Package\BasePackage;
  17982. use Composer\Semver\Constraint\Constraint;
  17983. use Composer\Package\Version\VersionParser;
  17984. use Composer\Repository\PlatformRepository;
  17985. use Composer\Spdx\SpdxLicenses;
  17986. class ValidatingArrayLoader implements LoaderInterface
  17987. {
  17988. const CHECK_ALL = 3;
  17989. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17990. const CHECK_STRICT_CONSTRAINTS = 2;
  17991. private $loader;
  17992. private $versionParser;
  17993. private $errors;
  17994. private $warnings;
  17995. private $config;
  17996. private $strictName;
  17997. private $flags;
  17998. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17999. {
  18000. $this->loader = $loader;
  18001. $this->versionParser = $parser ?: new VersionParser();
  18002. $this->strictName = $strictName;
  18003. $this->flags = $flags;
  18004. }
  18005. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18006. {
  18007. $this->errors = array();
  18008. $this->warnings = array();
  18009. $this->config = $config;
  18010. if ($err = self::hasPackageNamingError($config['name'])) {
  18011. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18012. }
  18013. if ($this->strictName) {
  18014. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18015. } else {
  18016. $this->validateString('name', true);
  18017. }
  18018. if (!empty($this->config['version'])) {
  18019. try {
  18020. $this->versionParser->normalize($this->config['version']);
  18021. } catch (\Exception $e) {
  18022. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18023. unset($this->config['version']);
  18024. }
  18025. }
  18026. if (!empty($this->config['config']['platform'])) {
  18027. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18028. try {
  18029. $this->versionParser->normalize($platform);
  18030. } catch (\Exception $e) {
  18031. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18032. }
  18033. }
  18034. }
  18035. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18036. $this->validateString('target-dir');
  18037. $this->validateArray('extra');
  18038. if (isset($this->config['bin'])) {
  18039. if (is_string($this->config['bin'])) {
  18040. $this->validateString('bin');
  18041. } else {
  18042. $this->validateFlatArray('bin');
  18043. }
  18044. }
  18045. $this->validateArray('scripts');
  18046. $this->validateString('description');
  18047. $this->validateUrl('homepage');
  18048. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18049. $releaseDate = null;
  18050. $this->validateString('time');
  18051. if (!empty($this->config['time'])) {
  18052. try {
  18053. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18054. } catch (\Exception $e) {
  18055. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18056. unset($this->config['time']);
  18057. }
  18058. }
  18059. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18060. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18061. $licenses = (array) $this->config['license'];
  18062. foreach ($licenses as $key => $license) {
  18063. if ('proprietary' === $license) {
  18064. unset($licenses[$key]);
  18065. }
  18066. }
  18067. $licenseValidator = new SpdxLicenses();
  18068. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  18069. $this->warnings[] = sprintf(
  18070. 'License %s must not contain extra spaces, make sure to trim it.',
  18071. json_encode($this->config['license'])
  18072. );
  18073. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  18074. $this->warnings[] = sprintf(
  18075. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18076. 'If the software is closed-source, you may use "proprietary" as license.',
  18077. json_encode($this->config['license'])
  18078. );
  18079. }
  18080. }
  18081. }
  18082. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18083. foreach ($this->config['authors'] as $key => $author) {
  18084. if (!is_array($author)) {
  18085. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18086. unset($this->config['authors'][$key]);
  18087. continue;
  18088. }
  18089. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18090. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18091. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18092. unset($this->config['authors'][$key][$authorData]);
  18093. }
  18094. }
  18095. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18096. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18097. unset($this->config['authors'][$key]['homepage']);
  18098. }
  18099. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18100. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18101. unset($this->config['authors'][$key]['email']);
  18102. }
  18103. if (empty($this->config['authors'][$key])) {
  18104. unset($this->config['authors'][$key]);
  18105. }
  18106. }
  18107. if (empty($this->config['authors'])) {
  18108. unset($this->config['authors']);
  18109. }
  18110. }
  18111. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18112. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18113. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18114. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18115. unset($this->config['support'][$key]);
  18116. }
  18117. }
  18118. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18119. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18120. unset($this->config['support']['email']);
  18121. }
  18122. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18123. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18124. unset($this->config['support']['irc']);
  18125. }
  18126. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18127. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18128. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18129. unset($this->config['support'][$key]);
  18130. }
  18131. }
  18132. if (empty($this->config['support'])) {
  18133. unset($this->config['support']);
  18134. }
  18135. }
  18136. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18137. $stableConstraint = new Constraint('=', '1.0.0');
  18138. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18139. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18140. foreach ($this->config[$linkType] as $package => $constraint) {
  18141. if ($err = self::hasPackageNamingError($package, true)) {
  18142. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18143. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18144. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18145. }
  18146. if (!is_string($constraint)) {
  18147. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18148. unset($this->config[$linkType][$package]);
  18149. } elseif ('self.version' !== $constraint) {
  18150. try {
  18151. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18152. } catch (\Exception $e) {
  18153. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18154. unset($this->config[$linkType][$package]);
  18155. continue;
  18156. }
  18157. if (
  18158. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18159. && 'require' === $linkType
  18160. && $linkConstraint->matches($unboundConstraint)
  18161. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18162. ) {
  18163. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18164. } elseif (
  18165. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18166. && 'require' === $linkType
  18167. && substr($linkConstraint, 0, 1) === '='
  18168. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18169. ) {
  18170. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18171. }
  18172. }
  18173. }
  18174. }
  18175. }
  18176. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18177. foreach ($this->config['suggest'] as $package => $description) {
  18178. if (!is_string($description)) {
  18179. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18180. unset($this->config['suggest'][$package]);
  18181. }
  18182. }
  18183. }
  18184. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18185. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18186. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18187. unset($this->config['minimum-stability']);
  18188. }
  18189. }
  18190. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18191. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18192. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18193. if (!in_array($type, $types)) {
  18194. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18195. unset($this->config['autoload'][$type]);
  18196. }
  18197. if ($type === 'psr-4') {
  18198. foreach ($typeConfig as $namespace => $dirs) {
  18199. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18200. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18201. }
  18202. }
  18203. }
  18204. }
  18205. }
  18206. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18207. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18208. unset($this->config['autoload']['psr-4']);
  18209. }
  18210. $this->validateFlatArray('include-path');
  18211. $this->validateArray('transport-options');
  18212. if (isset($this->config['extra']['branch-alias'])) {
  18213. if (!is_array($this->config['extra']['branch-alias'])) {
  18214. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18215. } else {
  18216. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18217. if ('-dev' !== substr($targetBranch, -4)) {
  18218. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18219. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18220. continue;
  18221. }
  18222. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18223. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18224. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18225. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18226. continue;
  18227. }
  18228. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18229. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18230. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18231. ) {
  18232. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  18233. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18234. }
  18235. }
  18236. }
  18237. }
  18238. if ($this->errors) {
  18239. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  18240. }
  18241. $package = $this->loader->load($this->config, $class);
  18242. $this->config = null;
  18243. return $package;
  18244. }
  18245. public function getWarnings()
  18246. {
  18247. return $this->warnings;
  18248. }
  18249. public function getErrors()
  18250. {
  18251. return $this->errors;
  18252. }
  18253. public static function hasPackageNamingError($name, $isLink = false)
  18254. {
  18255. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  18256. return;
  18257. }
  18258. if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) {
  18259. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".';
  18260. }
  18261. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  18262. $bits = explode('/', strtolower($name));
  18263. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  18264. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  18265. }
  18266. if (preg_match('{\.json$}', $name)) {
  18267. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  18268. }
  18269. if (preg_match('{[A-Z]}', $name)) {
  18270. if ($isLink) {
  18271. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  18272. }
  18273. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  18274. $suggestName = strtolower($suggestName);
  18275. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  18276. }
  18277. }
  18278. private function validateRegex($property, $regex, $mandatory = false)
  18279. {
  18280. if (!$this->validateString($property, $mandatory)) {
  18281. return false;
  18282. }
  18283. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  18284. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  18285. if ($mandatory) {
  18286. $this->errors[] = $message;
  18287. } else {
  18288. $this->warnings[] = $message;
  18289. }
  18290. unset($this->config[$property]);
  18291. return false;
  18292. }
  18293. return true;
  18294. }
  18295. private function validateString($property, $mandatory = false)
  18296. {
  18297. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  18298. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  18299. unset($this->config[$property]);
  18300. return false;
  18301. }
  18302. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  18303. if ($mandatory) {
  18304. $this->errors[] = $property.' : must be present';
  18305. }
  18306. unset($this->config[$property]);
  18307. return false;
  18308. }
  18309. return true;
  18310. }
  18311. private function validateArray($property, $mandatory = false)
  18312. {
  18313. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  18314. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  18315. unset($this->config[$property]);
  18316. return false;
  18317. }
  18318. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  18319. if ($mandatory) {
  18320. $this->errors[] = $property.' : must be present and contain at least one element';
  18321. }
  18322. unset($this->config[$property]);
  18323. return false;
  18324. }
  18325. return true;
  18326. }
  18327. private function validateFlatArray($property, $regex = null, $mandatory = false)
  18328. {
  18329. if (!$this->validateArray($property, $mandatory)) {
  18330. return false;
  18331. }
  18332. $pass = true;
  18333. foreach ($this->config[$property] as $key => $value) {
  18334. if (!is_string($value) && !is_numeric($value)) {
  18335. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  18336. unset($this->config[$property][$key]);
  18337. $pass = false;
  18338. continue;
  18339. }
  18340. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  18341. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  18342. unset($this->config[$property][$key]);
  18343. $pass = false;
  18344. }
  18345. }
  18346. return $pass;
  18347. }
  18348. private function validateUrl($property, $mandatory = false)
  18349. {
  18350. if (!$this->validateString($property, $mandatory)) {
  18351. return false;
  18352. }
  18353. if (!$this->filterUrl($this->config[$property])) {
  18354. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  18355. unset($this->config[$property]);
  18356. return false;
  18357. }
  18358. return true;
  18359. }
  18360. private function filterUrl($value, array $schemes = array('http', 'https'))
  18361. {
  18362. if ($value === '') {
  18363. return true;
  18364. }
  18365. $bits = parse_url($value);
  18366. if (empty($bits['scheme']) || empty($bits['host'])) {
  18367. return false;
  18368. }
  18369. if (!in_array($bits['scheme'], $schemes, true)) {
  18370. return false;
  18371. }
  18372. return true;
  18373. }
  18374. }
  18375. <?php
  18376. namespace Composer\Package;
  18377. use Composer\Json\JsonFile;
  18378. use Composer\Installer\InstallationManager;
  18379. use Composer\Repository\RepositoryManager;
  18380. use Composer\Util\ProcessExecutor;
  18381. use Composer\Repository\ArrayRepository;
  18382. use Composer\Package\Dumper\ArrayDumper;
  18383. use Composer\Package\Loader\ArrayLoader;
  18384. use Composer\Util\Git as GitUtil;
  18385. use Composer\IO\IOInterface;
  18386. use Seld\JsonLint\ParsingException;
  18387. class Locker
  18388. {
  18389. private $lockFile;
  18390. private $repositoryManager;
  18391. private $installationManager;
  18392. private $hash;
  18393. private $contentHash;
  18394. private $loader;
  18395. private $dumper;
  18396. private $process;
  18397. private $lockDataCache;
  18398. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  18399. {
  18400. $this->lockFile = $lockFile;
  18401. $this->repositoryManager = $repositoryManager;
  18402. $this->installationManager = $installationManager;
  18403. $this->hash = md5($composerFileContents);
  18404. $this->contentHash = self::getContentHash($composerFileContents);
  18405. $this->loader = new ArrayLoader(null, true);
  18406. $this->dumper = new ArrayDumper();
  18407. $this->process = new ProcessExecutor($io);
  18408. }
  18409. public static function getContentHash($composerFileContents)
  18410. {
  18411. $content = json_decode($composerFileContents, true);
  18412. $relevantKeys = array(
  18413. 'name',
  18414. 'version',
  18415. 'require',
  18416. 'require-dev',
  18417. 'conflict',
  18418. 'replace',
  18419. 'provide',
  18420. 'minimum-stability',
  18421. 'prefer-stable',
  18422. 'repositories',
  18423. 'extra',
  18424. );
  18425. $relevantContent = array();
  18426. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18427. $relevantContent[$key] = $content[$key];
  18428. }
  18429. if (isset($content['config']['platform'])) {
  18430. $relevantContent['config']['platform'] = $content['config']['platform'];
  18431. }
  18432. ksort($relevantContent);
  18433. return md5(json_encode($relevantContent));
  18434. }
  18435. public function isLocked()
  18436. {
  18437. if (!$this->lockFile->exists()) {
  18438. return false;
  18439. }
  18440. $data = $this->getLockData();
  18441. return isset($data['packages']);
  18442. }
  18443. public function isFresh()
  18444. {
  18445. $lock = $this->lockFile->read();
  18446. if (!empty($lock['content-hash'])) {
  18447. return $this->contentHash === $lock['content-hash'];
  18448. }
  18449. if (!empty($lock['hash'])) {
  18450. return $this->hash === $lock['hash'];
  18451. }
  18452. return false;
  18453. }
  18454. public function getLockedRepository($withDevReqs = false)
  18455. {
  18456. $lockData = $this->getLockData();
  18457. $packages = new ArrayRepository();
  18458. $lockedPackages = $lockData['packages'];
  18459. if ($withDevReqs) {
  18460. if (isset($lockData['packages-dev'])) {
  18461. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18462. } else {
  18463. 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.');
  18464. }
  18465. }
  18466. if (empty($lockedPackages)) {
  18467. return $packages;
  18468. }
  18469. if (isset($lockedPackages[0]['name'])) {
  18470. foreach ($lockedPackages as $info) {
  18471. $packages->addPackage($this->loader->load($info));
  18472. }
  18473. return $packages;
  18474. }
  18475. 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.');
  18476. }
  18477. public function getPlatformRequirements($withDevReqs = false)
  18478. {
  18479. $lockData = $this->getLockData();
  18480. $requirements = array();
  18481. if (!empty($lockData['platform'])) {
  18482. $requirements = $this->loader->parseLinks(
  18483. '__ROOT__',
  18484. '1.0.0',
  18485. 'requires',
  18486. isset($lockData['platform']) ? $lockData['platform'] : array()
  18487. );
  18488. }
  18489. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18490. $devRequirements = $this->loader->parseLinks(
  18491. '__ROOT__',
  18492. '1.0.0',
  18493. 'requires',
  18494. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18495. );
  18496. $requirements = array_merge($requirements, $devRequirements);
  18497. }
  18498. return $requirements;
  18499. }
  18500. public function getMinimumStability()
  18501. {
  18502. $lockData = $this->getLockData();
  18503. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18504. }
  18505. public function getStabilityFlags()
  18506. {
  18507. $lockData = $this->getLockData();
  18508. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18509. }
  18510. public function getPreferStable()
  18511. {
  18512. $lockData = $this->getLockData();
  18513. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18514. }
  18515. public function getPreferLowest()
  18516. {
  18517. $lockData = $this->getLockData();
  18518. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18519. }
  18520. public function getPlatformOverrides()
  18521. {
  18522. $lockData = $this->getLockData();
  18523. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18524. }
  18525. public function getAliases()
  18526. {
  18527. $lockData = $this->getLockData();
  18528. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18529. }
  18530. public function getLockData()
  18531. {
  18532. if (null !== $this->lockDataCache) {
  18533. return $this->lockDataCache;
  18534. }
  18535. if (!$this->lockFile->exists()) {
  18536. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18537. }
  18538. return $this->lockDataCache = $this->lockFile->read();
  18539. }
  18540. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18541. {
  18542. $lock = array(
  18543. '_readme' => array('This file locks the dependencies of your project to a known state',
  18544. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18545. 'This file is @gener'.'ated automatically', ),
  18546. 'content-hash' => $this->contentHash,
  18547. 'packages' => null,
  18548. 'packages-dev' => null,
  18549. 'aliases' => array(),
  18550. 'minimum-stability' => $minimumStability,
  18551. 'stability-flags' => $stabilityFlags,
  18552. 'prefer-stable' => $preferStable,
  18553. 'prefer-lowest' => $preferLowest,
  18554. );
  18555. foreach ($aliases as $package => $versions) {
  18556. foreach ($versions as $version => $alias) {
  18557. $lock['aliases'][] = array(
  18558. 'alias' => $alias['alias'],
  18559. 'alias_normalized' => $alias['alias_normalized'],
  18560. 'version' => $version,
  18561. 'package' => $package,
  18562. );
  18563. }
  18564. }
  18565. $lock['packages'] = $this->lockPackages($packages);
  18566. if (null !== $devPackages) {
  18567. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18568. }
  18569. $lock['platform'] = $platformReqs;
  18570. $lock['platform-dev'] = $platformDevReqs;
  18571. if ($platformOverrides) {
  18572. $lock['platform-overrides'] = $platformOverrides;
  18573. }
  18574. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18575. if ($this->lockFile->exists()) {
  18576. unlink($this->lockFile->getPath());
  18577. }
  18578. return false;
  18579. }
  18580. try {
  18581. $isLocked = $this->isLocked();
  18582. } catch (ParsingException $e) {
  18583. $isLocked = false;
  18584. }
  18585. if (!$isLocked || $lock !== $this->getLockData()) {
  18586. $this->lockFile->write($lock);
  18587. $this->lockDataCache = null;
  18588. return true;
  18589. }
  18590. return false;
  18591. }
  18592. private function lockPackages(array $packages)
  18593. {
  18594. $locked = array();
  18595. foreach ($packages as $package) {
  18596. if ($package instanceof AliasPackage) {
  18597. continue;
  18598. }
  18599. $name = $package->getPrettyName();
  18600. $version = $package->getPrettyVersion();
  18601. if (!$name || !$version) {
  18602. throw new \LogicException(sprintf(
  18603. 'Package "%s" has no version or name and can not be locked',
  18604. $package
  18605. ));
  18606. }
  18607. $spec = $this->dumper->dump($package);
  18608. unset($spec['version_normalized']);
  18609. $time = isset($spec['time']) ? $spec['time'] : null;
  18610. unset($spec['time']);
  18611. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18612. $time = $this->getPackageTime($package) ?: $time;
  18613. }
  18614. if (null !== $time) {
  18615. $spec['time'] = $time;
  18616. }
  18617. unset($spec['installation-source']);
  18618. $locked[] = $spec;
  18619. }
  18620. usort($locked, function ($a, $b) {
  18621. $comparison = strcmp($a['name'], $b['name']);
  18622. if (0 !== $comparison) {
  18623. return $comparison;
  18624. }
  18625. return strcmp($a['version'], $b['version']);
  18626. });
  18627. return $locked;
  18628. }
  18629. private function getPackageTime(PackageInterface $package)
  18630. {
  18631. if (!function_exists('proc_open')) {
  18632. return null;
  18633. }
  18634. $path = realpath($this->installationManager->getInstallPath($package));
  18635. $sourceType = $package->getSourceType();
  18636. $datetime = null;
  18637. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18638. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18639. switch ($sourceType) {
  18640. case 'git':
  18641. GitUtil::cleanEnv();
  18642. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18643. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18644. }
  18645. break;
  18646. case 'hg':
  18647. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18648. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18649. }
  18650. break;
  18651. }
  18652. }
  18653. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18654. }
  18655. }
  18656. <?php
  18657. namespace Composer\Package;
  18658. use Composer\Package\Version\VersionParser;
  18659. use Composer\Util\ComposerMirror;
  18660. class Package extends BasePackage
  18661. {
  18662. protected $type;
  18663. protected $targetDir;
  18664. protected $installationSource;
  18665. protected $sourceType;
  18666. protected $sourceUrl;
  18667. protected $sourceReference;
  18668. protected $sourceMirrors;
  18669. protected $distType;
  18670. protected $distUrl;
  18671. protected $distReference;
  18672. protected $distSha1Checksum;
  18673. protected $distMirrors;
  18674. protected $version;
  18675. protected $prettyVersion;
  18676. protected $releaseDate;
  18677. protected $extra = array();
  18678. protected $binaries = array();
  18679. protected $dev;
  18680. protected $stability;
  18681. protected $notificationUrl;
  18682. protected $requires = array();
  18683. protected $conflicts = array();
  18684. protected $provides = array();
  18685. protected $replaces = array();
  18686. protected $devRequires = array();
  18687. protected $suggests = array();
  18688. protected $autoload = array();
  18689. protected $devAutoload = array();
  18690. protected $includePaths = array();
  18691. protected $archiveExcludes = array();
  18692. public function __construct($name, $version, $prettyVersion)
  18693. {
  18694. parent::__construct($name);
  18695. $this->version = $version;
  18696. $this->prettyVersion = $prettyVersion;
  18697. $this->stability = VersionParser::parseStability($version);
  18698. $this->dev = $this->stability === 'dev';
  18699. }
  18700. public function isDev()
  18701. {
  18702. return $this->dev;
  18703. }
  18704. public function setType($type)
  18705. {
  18706. $this->type = $type;
  18707. }
  18708. public function getType()
  18709. {
  18710. return $this->type ?: 'library';
  18711. }
  18712. public function getStability()
  18713. {
  18714. return $this->stability;
  18715. }
  18716. public function setTargetDir($targetDir)
  18717. {
  18718. $this->targetDir = $targetDir;
  18719. }
  18720. public function getTargetDir()
  18721. {
  18722. if (null === $this->targetDir) {
  18723. return;
  18724. }
  18725. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18726. }
  18727. public function setExtra(array $extra)
  18728. {
  18729. $this->extra = $extra;
  18730. }
  18731. public function getExtra()
  18732. {
  18733. return $this->extra;
  18734. }
  18735. public function setBinaries(array $binaries)
  18736. {
  18737. $this->binaries = $binaries;
  18738. }
  18739. public function getBinaries()
  18740. {
  18741. return $this->binaries;
  18742. }
  18743. public function setInstallationSource($type)
  18744. {
  18745. $this->installationSource = $type;
  18746. }
  18747. public function getInstallationSource()
  18748. {
  18749. return $this->installationSource;
  18750. }
  18751. public function setSourceType($type)
  18752. {
  18753. $this->sourceType = $type;
  18754. }
  18755. public function getSourceType()
  18756. {
  18757. return $this->sourceType;
  18758. }
  18759. public function setSourceUrl($url)
  18760. {
  18761. $this->sourceUrl = $url;
  18762. }
  18763. public function getSourceUrl()
  18764. {
  18765. return $this->sourceUrl;
  18766. }
  18767. public function setSourceReference($reference)
  18768. {
  18769. $this->sourceReference = $reference;
  18770. }
  18771. public function getSourceReference()
  18772. {
  18773. return $this->sourceReference;
  18774. }
  18775. public function setSourceMirrors($mirrors)
  18776. {
  18777. $this->sourceMirrors = $mirrors;
  18778. }
  18779. public function getSourceMirrors()
  18780. {
  18781. return $this->sourceMirrors;
  18782. }
  18783. public function getSourceUrls()
  18784. {
  18785. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18786. }
  18787. public function setDistType($type)
  18788. {
  18789. $this->distType = $type;
  18790. }
  18791. public function getDistType()
  18792. {
  18793. return $this->distType;
  18794. }
  18795. public function setDistUrl($url)
  18796. {
  18797. $this->distUrl = $url;
  18798. }
  18799. public function getDistUrl()
  18800. {
  18801. return $this->distUrl;
  18802. }
  18803. public function setDistReference($reference)
  18804. {
  18805. $this->distReference = $reference;
  18806. }
  18807. public function getDistReference()
  18808. {
  18809. return $this->distReference;
  18810. }
  18811. public function setDistSha1Checksum($sha1checksum)
  18812. {
  18813. $this->distSha1Checksum = $sha1checksum;
  18814. }
  18815. public function getDistSha1Checksum()
  18816. {
  18817. return $this->distSha1Checksum;
  18818. }
  18819. public function setDistMirrors($mirrors)
  18820. {
  18821. $this->distMirrors = $mirrors;
  18822. }
  18823. public function getDistMirrors()
  18824. {
  18825. return $this->distMirrors;
  18826. }
  18827. public function getDistUrls()
  18828. {
  18829. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18830. }
  18831. public function getVersion()
  18832. {
  18833. return $this->version;
  18834. }
  18835. public function getPrettyVersion()
  18836. {
  18837. return $this->prettyVersion;
  18838. }
  18839. public function setReleaseDate(\DateTime $releaseDate)
  18840. {
  18841. $this->releaseDate = $releaseDate;
  18842. }
  18843. public function getReleaseDate()
  18844. {
  18845. return $this->releaseDate;
  18846. }
  18847. public function setRequires(array $requires)
  18848. {
  18849. $this->requires = $requires;
  18850. }
  18851. public function getRequires()
  18852. {
  18853. return $this->requires;
  18854. }
  18855. public function setConflicts(array $conflicts)
  18856. {
  18857. $this->conflicts = $conflicts;
  18858. }
  18859. public function getConflicts()
  18860. {
  18861. return $this->conflicts;
  18862. }
  18863. public function setProvides(array $provides)
  18864. {
  18865. $this->provides = $provides;
  18866. }
  18867. public function getProvides()
  18868. {
  18869. return $this->provides;
  18870. }
  18871. public function setReplaces(array $replaces)
  18872. {
  18873. $this->replaces = $replaces;
  18874. }
  18875. public function getReplaces()
  18876. {
  18877. return $this->replaces;
  18878. }
  18879. public function setDevRequires(array $devRequires)
  18880. {
  18881. $this->devRequires = $devRequires;
  18882. }
  18883. public function getDevRequires()
  18884. {
  18885. return $this->devRequires;
  18886. }
  18887. public function setSuggests(array $suggests)
  18888. {
  18889. $this->suggests = $suggests;
  18890. }
  18891. public function getSuggests()
  18892. {
  18893. return $this->suggests;
  18894. }
  18895. public function setAutoload(array $autoload)
  18896. {
  18897. $this->autoload = $autoload;
  18898. }
  18899. public function getAutoload()
  18900. {
  18901. return $this->autoload;
  18902. }
  18903. public function setDevAutoload(array $devAutoload)
  18904. {
  18905. $this->devAutoload = $devAutoload;
  18906. }
  18907. public function getDevAutoload()
  18908. {
  18909. return $this->devAutoload;
  18910. }
  18911. public function setIncludePaths(array $includePaths)
  18912. {
  18913. $this->includePaths = $includePaths;
  18914. }
  18915. public function getIncludePaths()
  18916. {
  18917. return $this->includePaths;
  18918. }
  18919. public function setNotificationUrl($notificationUrl)
  18920. {
  18921. $this->notificationUrl = $notificationUrl;
  18922. }
  18923. public function getNotificationUrl()
  18924. {
  18925. return $this->notificationUrl;
  18926. }
  18927. public function setArchiveExcludes(array $excludes)
  18928. {
  18929. $this->archiveExcludes = $excludes;
  18930. }
  18931. public function getArchiveExcludes()
  18932. {
  18933. return $this->archiveExcludes;
  18934. }
  18935. public function replaceVersion($version, $prettyVersion)
  18936. {
  18937. $this->version = $version;
  18938. $this->prettyVersion = $prettyVersion;
  18939. $this->stability = VersionParser::parseStability($version);
  18940. $this->dev = $this->stability === 'dev';
  18941. }
  18942. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18943. {
  18944. if (!$url) {
  18945. return array();
  18946. }
  18947. $urls = array($url);
  18948. if ($mirrors) {
  18949. foreach ($mirrors as $mirror) {
  18950. if ($urlType === 'dist') {
  18951. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18952. } elseif ($urlType === 'source' && $type === 'git') {
  18953. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18954. } elseif ($urlType === 'source' && $type === 'hg') {
  18955. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18956. }
  18957. if (!in_array($mirrorUrl, $urls)) {
  18958. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18959. $func($urls, $mirrorUrl);
  18960. }
  18961. }
  18962. }
  18963. return $urls;
  18964. }
  18965. }
  18966. <?php
  18967. namespace Composer\Package;
  18968. use Composer\Repository\RepositoryInterface;
  18969. interface PackageInterface
  18970. {
  18971. public function getName();
  18972. public function getPrettyName();
  18973. public function getNames();
  18974. public function setId($id);
  18975. public function getId();
  18976. public function isDev();
  18977. public function getType();
  18978. public function getTargetDir();
  18979. public function getExtra();
  18980. public function setInstallationSource($type);
  18981. public function getInstallationSource();
  18982. public function getSourceType();
  18983. public function getSourceUrl();
  18984. public function getSourceUrls();
  18985. public function getSourceReference();
  18986. public function getSourceMirrors();
  18987. public function getDistType();
  18988. public function getDistUrl();
  18989. public function getDistUrls();
  18990. public function getDistReference();
  18991. public function getDistSha1Checksum();
  18992. public function getDistMirrors();
  18993. public function getVersion();
  18994. public function getPrettyVersion();
  18995. public function getFullPrettyVersion($truncate = true);
  18996. public function getReleaseDate();
  18997. public function getStability();
  18998. public function getRequires();
  18999. public function getConflicts();
  19000. public function getProvides();
  19001. public function getReplaces();
  19002. public function getDevRequires();
  19003. public function getSuggests();
  19004. public function getAutoload();
  19005. public function getDevAutoload();
  19006. public function getIncludePaths();
  19007. public function setRepository(RepositoryInterface $repository);
  19008. public function getRepository();
  19009. public function getBinaries();
  19010. public function getUniqueName();
  19011. public function getNotificationUrl();
  19012. public function __toString();
  19013. public function getPrettyString();
  19014. public function getArchiveExcludes();
  19015. public function getTransportOptions();
  19016. public function setSourceReference($reference);
  19017. public function setDistUrl($url);
  19018. public function setDistType($type);
  19019. public function setDistReference($reference);
  19020. }
  19021. <?php
  19022. namespace Composer\Package;
  19023. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19024. {
  19025. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19026. {
  19027. parent::__construct($aliasOf, $version, $prettyVersion);
  19028. }
  19029. public function getAliases()
  19030. {
  19031. return $this->aliasOf->getAliases();
  19032. }
  19033. public function getMinimumStability()
  19034. {
  19035. return $this->aliasOf->getMinimumStability();
  19036. }
  19037. public function getStabilityFlags()
  19038. {
  19039. return $this->aliasOf->getStabilityFlags();
  19040. }
  19041. public function getReferences()
  19042. {
  19043. return $this->aliasOf->getReferences();
  19044. }
  19045. public function getPreferStable()
  19046. {
  19047. return $this->aliasOf->getPreferStable();
  19048. }
  19049. public function getConfig()
  19050. {
  19051. return $this->aliasOf->getConfig();
  19052. }
  19053. public function setRequires(array $require)
  19054. {
  19055. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19056. $this->aliasOf->setRequires($require);
  19057. }
  19058. public function setDevRequires(array $devRequire)
  19059. {
  19060. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19061. $this->aliasOf->setDevRequires($devRequire);
  19062. }
  19063. public function setConflicts(array $conflicts)
  19064. {
  19065. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19066. $this->aliasOf->setConflicts($conflicts);
  19067. }
  19068. public function setProvides(array $provides)
  19069. {
  19070. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19071. $this->aliasOf->setProvides($provides);
  19072. }
  19073. public function setReplaces(array $replaces)
  19074. {
  19075. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19076. $this->aliasOf->setReplaces($replaces);
  19077. }
  19078. public function setRepositories($repositories)
  19079. {
  19080. $this->aliasOf->setRepositories($repositories);
  19081. }
  19082. public function setAutoload(array $autoload)
  19083. {
  19084. $this->aliasOf->setAutoload($autoload);
  19085. }
  19086. public function setDevAutoload(array $devAutoload)
  19087. {
  19088. $this->aliasOf->setDevAutoload($devAutoload);
  19089. }
  19090. public function setStabilityFlags(array $stabilityFlags)
  19091. {
  19092. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19093. }
  19094. public function setSuggests(array $suggests)
  19095. {
  19096. $this->aliasOf->setSuggests($suggests);
  19097. }
  19098. public function setExtra(array $extra)
  19099. {
  19100. $this->aliasOf->setExtra($extra);
  19101. }
  19102. public function __clone()
  19103. {
  19104. parent::__clone();
  19105. $this->aliasOf = clone $this->aliasOf;
  19106. }
  19107. }
  19108. <?php
  19109. namespace Composer\Package;
  19110. class RootPackage extends CompletePackage implements RootPackageInterface
  19111. {
  19112. protected $minimumStability = 'stable';
  19113. protected $preferStable = false;
  19114. protected $stabilityFlags = array();
  19115. protected $config = array();
  19116. protected $references = array();
  19117. protected $aliases = array();
  19118. public function setMinimumStability($minimumStability)
  19119. {
  19120. $this->minimumStability = $minimumStability;
  19121. }
  19122. public function getMinimumStability()
  19123. {
  19124. return $this->minimumStability;
  19125. }
  19126. public function setStabilityFlags(array $stabilityFlags)
  19127. {
  19128. $this->stabilityFlags = $stabilityFlags;
  19129. }
  19130. public function getStabilityFlags()
  19131. {
  19132. return $this->stabilityFlags;
  19133. }
  19134. public function setPreferStable($preferStable)
  19135. {
  19136. $this->preferStable = $preferStable;
  19137. }
  19138. public function getPreferStable()
  19139. {
  19140. return $this->preferStable;
  19141. }
  19142. public function setConfig(array $config)
  19143. {
  19144. $this->config = $config;
  19145. }
  19146. public function getConfig()
  19147. {
  19148. return $this->config;
  19149. }
  19150. public function setReferences(array $references)
  19151. {
  19152. $this->references = $references;
  19153. }
  19154. public function getReferences()
  19155. {
  19156. return $this->references;
  19157. }
  19158. public function setAliases(array $aliases)
  19159. {
  19160. $this->aliases = $aliases;
  19161. }
  19162. public function getAliases()
  19163. {
  19164. return $this->aliases;
  19165. }
  19166. }
  19167. <?php
  19168. namespace Composer\Package;
  19169. interface RootPackageInterface extends CompletePackageInterface
  19170. {
  19171. public function getAliases();
  19172. public function getMinimumStability();
  19173. public function getStabilityFlags();
  19174. public function getReferences();
  19175. public function getPreferStable();
  19176. public function getConfig();
  19177. public function setRequires(array $requires);
  19178. public function setDevRequires(array $devRequires);
  19179. public function setConflicts(array $conflicts);
  19180. public function setProvides(array $provides);
  19181. public function setReplaces(array $replaces);
  19182. public function setRepositories($repositories);
  19183. public function setAutoload(array $autoload);
  19184. public function setDevAutoload(array $devAutoload);
  19185. public function setStabilityFlags(array $stabilityFlags);
  19186. public function setSuggests(array $suggests);
  19187. public function setExtra(array $extra);
  19188. }
  19189. <?php
  19190. namespace Composer\Package\Version;
  19191. use Composer\Config;
  19192. use Composer\Repository\Vcs\HgDriver;
  19193. use Composer\IO\NullIO;
  19194. use Composer\Semver\VersionParser as SemverVersionParser;
  19195. use Composer\Util\Git as GitUtil;
  19196. use Composer\Util\ProcessExecutor;
  19197. use Composer\Util\Svn as SvnUtil;
  19198. class VersionGuesser
  19199. {
  19200. private $config;
  19201. private $process;
  19202. private $versionParser;
  19203. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19204. {
  19205. $this->config = $config;
  19206. $this->process = $process;
  19207. $this->versionParser = $versionParser;
  19208. }
  19209. public function guessVersion(array $packageConfig, $path)
  19210. {
  19211. if (function_exists('proc_open')) {
  19212. $versionData = $this->guessGitVersion($packageConfig, $path);
  19213. if (null !== $versionData && null !== $versionData['version']) {
  19214. return $this->postprocess($versionData);
  19215. }
  19216. $versionData = $this->guessHgVersion($packageConfig, $path);
  19217. if (null !== $versionData && null !== $versionData['version']) {
  19218. return $this->postprocess($versionData);
  19219. }
  19220. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19221. if (null !== $versionData && null !== $versionData['version']) {
  19222. return $this->postprocess($versionData);
  19223. }
  19224. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19225. if (null !== $versionData && null !== $versionData['version']) {
  19226. return $this->postprocess($versionData);
  19227. }
  19228. }
  19229. }
  19230. private function postprocess(array $versionData)
  19231. {
  19232. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  19233. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  19234. }
  19235. return $versionData;
  19236. }
  19237. private function guessGitVersion(array $packageConfig, $path)
  19238. {
  19239. GitUtil::cleanEnv();
  19240. $commit = null;
  19241. $version = null;
  19242. $prettyVersion = null;
  19243. $isDetached = false;
  19244. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  19245. $branches = array();
  19246. $isFeatureBranch = false;
  19247. foreach ($this->process->splitLines($output) as $branch) {
  19248. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19249. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  19250. $version = 'dev-' . $match[2];
  19251. $prettyVersion = $version;
  19252. $isFeatureBranch = true;
  19253. $isDetached = true;
  19254. } else {
  19255. $version = $this->versionParser->normalizeBranch($match[1]);
  19256. $prettyVersion = 'dev-' . $match[1];
  19257. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19258. }
  19259. if ($match[2]) {
  19260. $commit = $match[2];
  19261. }
  19262. }
  19263. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19264. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19265. $branches[] = $match[1];
  19266. }
  19267. }
  19268. }
  19269. if ($isFeatureBranch) {
  19270. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  19271. $version = $result['version'];
  19272. $prettyVersion = $result['pretty_version'];
  19273. }
  19274. }
  19275. if (!$version || $isDetached) {
  19276. $result = $this->versionFromGitTags($path);
  19277. if ($result) {
  19278. $version = $result['version'];
  19279. $prettyVersion = $result['pretty_version'];
  19280. }
  19281. }
  19282. if (!$commit) {
  19283. $command = 'git log --pretty="%H" -n1 HEAD';
  19284. if (0 === $this->process->execute($command, $output, $path)) {
  19285. $commit = trim($output) ?: null;
  19286. }
  19287. }
  19288. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  19289. }
  19290. private function versionFromGitTags($path)
  19291. {
  19292. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  19293. try {
  19294. $version = $this->versionParser->normalize(trim($output));
  19295. return array('version' => $version, 'pretty_version' => trim($output));
  19296. } catch (\Exception $e) {
  19297. }
  19298. }
  19299. return null;
  19300. }
  19301. private function guessHgVersion(array $packageConfig, $path)
  19302. {
  19303. if (0 === $this->process->execute('hg branch', $output, $path)) {
  19304. $branch = trim($output);
  19305. $version = $this->versionParser->normalizeBranch($branch);
  19306. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19307. if ('9999999-dev' === $version) {
  19308. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  19309. }
  19310. if (!$isFeatureBranch) {
  19311. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  19312. }
  19313. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  19314. $branches = array_keys($driver->getBranches());
  19315. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  19316. $result['commit'] = '';
  19317. return $result;
  19318. }
  19319. }
  19320. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  19321. {
  19322. $prettyVersion = $version;
  19323. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  19324. || strpos(json_encode($packageConfig), '"self.version"')
  19325. ) {
  19326. $branch = preg_replace('{^dev-}', '', $version);
  19327. $length = PHP_INT_MAX;
  19328. $nonFeatureBranches = '';
  19329. if (!empty($packageConfig['non-feature-branches'])) {
  19330. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  19331. }
  19332. foreach ($branches as $candidate) {
  19333. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  19334. break;
  19335. }
  19336. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  19337. continue;
  19338. }
  19339. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  19340. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  19341. continue;
  19342. }
  19343. if (strlen($output) < $length) {
  19344. $length = strlen($output);
  19345. $version = $this->versionParser->normalizeBranch($candidate);
  19346. $prettyVersion = 'dev-' . $match[1];
  19347. }
  19348. }
  19349. }
  19350. return array('version' => $version, 'pretty_version' => $prettyVersion);
  19351. }
  19352. private function guessFossilVersion(array $packageConfig, $path)
  19353. {
  19354. $version = null;
  19355. $prettyVersion = null;
  19356. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  19357. $branch = trim($output);
  19358. $version = $this->versionParser->normalizeBranch($branch);
  19359. $prettyVersion = 'dev-' . $branch;
  19360. }
  19361. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  19362. try {
  19363. $version = $this->versionParser->normalize(trim($output));
  19364. $prettyVersion = trim($output);
  19365. } catch (\Exception $e) {
  19366. }
  19367. }
  19368. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19369. }
  19370. private function guessSvnVersion(array $packageConfig, $path)
  19371. {
  19372. SvnUtil::cleanEnv();
  19373. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  19374. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  19375. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  19376. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  19377. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  19378. if (preg_match($urlPattern, $output, $matches)) {
  19379. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  19380. $version = $this->versionParser->normalizeBranch($matches[3]);
  19381. $prettyVersion = 'dev-' . $matches[3];
  19382. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19383. }
  19384. $prettyVersion = trim($matches[1]);
  19385. $version = $this->versionParser->normalize($prettyVersion);
  19386. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19387. }
  19388. }
  19389. }
  19390. }
  19391. <?php
  19392. namespace Composer\Package\Version;
  19393. use Composer\Repository\PlatformRepository;
  19394. use Composer\Semver\VersionParser as SemverVersionParser;
  19395. use Composer\Semver\Semver;
  19396. class VersionParser extends SemverVersionParser
  19397. {
  19398. private static $constraints = array();
  19399. public function parseConstraints($constraints)
  19400. {
  19401. if (!isset(self::$constraints[$constraints])) {
  19402. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  19403. }
  19404. return self::$constraints[$constraints];
  19405. }
  19406. public function parseNameVersionPairs(array $pairs)
  19407. {
  19408. $pairs = array_values($pairs);
  19409. $result = array();
  19410. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19411. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19412. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19413. $pair .= ' '.$pairs[$i + 1];
  19414. $i++;
  19415. }
  19416. if (strpos($pair, ' ')) {
  19417. list($name, $version) = explode(' ', $pair, 2);
  19418. $result[] = array('name' => $name, 'version' => $version);
  19419. } else {
  19420. $result[] = array('name' => $pair);
  19421. }
  19422. }
  19423. return $result;
  19424. }
  19425. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19426. {
  19427. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19428. return true;
  19429. }
  19430. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19431. return $sorted[0] === $normalizedFrom;
  19432. }
  19433. }
  19434. <?php
  19435. namespace Composer\Package\Version;
  19436. use Composer\DependencyResolver\Pool;
  19437. use Composer\Package\BasePackage;
  19438. use Composer\Package\PackageInterface;
  19439. use Composer\Package\Loader\ArrayLoader;
  19440. use Composer\Package\Dumper\ArrayDumper;
  19441. use Composer\Semver\Constraint\Constraint;
  19442. class VersionSelector
  19443. {
  19444. private $pool;
  19445. private $parser;
  19446. public function __construct(Pool $pool)
  19447. {
  19448. $this->pool = $pool;
  19449. }
  19450. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19451. {
  19452. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19453. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19454. if ($targetPhpVersion) {
  19455. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19456. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19457. $reqs = $pkg->getRequires();
  19458. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19459. });
  19460. }
  19461. if (!$candidates) {
  19462. return false;
  19463. }
  19464. $package = reset($candidates);
  19465. $minPriority = BasePackage::$stabilities[$preferredStability];
  19466. foreach ($candidates as $candidate) {
  19467. $candidatePriority = $candidate->getStabilityPriority();
  19468. $currentPriority = $package->getStabilityPriority();
  19469. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19470. continue;
  19471. }
  19472. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19473. $package = $candidate;
  19474. continue;
  19475. }
  19476. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19477. $package = $candidate;
  19478. continue;
  19479. }
  19480. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19481. $package = $candidate;
  19482. }
  19483. }
  19484. return $package;
  19485. }
  19486. public function findRecommendedRequireVersion(PackageInterface $package)
  19487. {
  19488. $version = $package->getVersion();
  19489. if (!$package->isDev()) {
  19490. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19491. }
  19492. $loader = new ArrayLoader($this->getParser());
  19493. $dumper = new ArrayDumper();
  19494. $extra = $loader->getBranchAlias($dumper->dump($package));
  19495. if ($extra) {
  19496. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19497. if ($count) {
  19498. $extra = str_replace('.9999999', '.0', $extra);
  19499. return $this->transformVersion($extra, $extra, 'dev');
  19500. }
  19501. }
  19502. return $package->getPrettyVersion();
  19503. }
  19504. private function transformVersion($version, $prettyVersion, $stability)
  19505. {
  19506. $semanticVersionParts = explode('.', $version);
  19507. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19508. if ($semanticVersionParts[0] === '0') {
  19509. unset($semanticVersionParts[3]);
  19510. } else {
  19511. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19512. }
  19513. $version = implode('.', $semanticVersionParts);
  19514. } else {
  19515. return $prettyVersion;
  19516. }
  19517. if ($stability != 'stable') {
  19518. $version .= '@'.$stability;
  19519. }
  19520. return '^' . $version;
  19521. }
  19522. private function getParser()
  19523. {
  19524. if ($this->parser === null) {
  19525. $this->parser = new VersionParser();
  19526. }
  19527. return $this->parser;
  19528. }
  19529. }
  19530. <?php
  19531. namespace Composer\Plugin\Capability;
  19532. interface Capability
  19533. {
  19534. }
  19535. <?php
  19536. namespace Composer\Plugin\Capability;
  19537. interface CommandProvider extends Capability
  19538. {
  19539. public function getCommands();
  19540. }
  19541. <?php
  19542. namespace Composer\Plugin;
  19543. interface Capable
  19544. {
  19545. public function getCapabilities();
  19546. }
  19547. <?php
  19548. namespace Composer\Plugin;
  19549. use Composer\EventDispatcher\Event;
  19550. use Symfony\Component\Console\Input\InputInterface;
  19551. use Symfony\Component\Console\Output\OutputInterface;
  19552. class CommandEvent extends Event
  19553. {
  19554. private $commandName;
  19555. private $input;
  19556. private $output;
  19557. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19558. {
  19559. parent::__construct($name, $args, $flags);
  19560. $this->commandName = $commandName;
  19561. $this->input = $input;
  19562. $this->output = $output;
  19563. }
  19564. public function getInput()
  19565. {
  19566. return $this->input;
  19567. }
  19568. public function getOutput()
  19569. {
  19570. return $this->output;
  19571. }
  19572. public function getCommandName()
  19573. {
  19574. return $this->commandName;
  19575. }
  19576. }
  19577. <?php
  19578. namespace Composer\Plugin;
  19579. class PluginEvents
  19580. {
  19581. const INIT = 'init';
  19582. const COMMAND = 'command';
  19583. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19584. const PRE_COMMAND_RUN = 'pre-command-run';
  19585. }
  19586. <?php
  19587. namespace Composer\Plugin;
  19588. use Composer\Composer;
  19589. use Composer\IO\IOInterface;
  19590. interface PluginInterface
  19591. {
  19592. const PLUGIN_API_VERSION = '1.1.0';
  19593. public function activate(Composer $composer, IOInterface $io);
  19594. }
  19595. <?php
  19596. namespace Composer\Plugin;
  19597. use Composer\Composer;
  19598. use Composer\EventDispatcher\EventSubscriberInterface;
  19599. use Composer\IO\IOInterface;
  19600. use Composer\Package\CompletePackage;
  19601. use Composer\Package\Package;
  19602. use Composer\Package\Version\VersionParser;
  19603. use Composer\Repository\RepositoryInterface;
  19604. use Composer\Package\PackageInterface;
  19605. use Composer\Package\Link;
  19606. use Composer\Semver\Constraint\Constraint;
  19607. use Composer\DependencyResolver\Pool;
  19608. use Composer\Plugin\Capability\Capability;
  19609. use Composer\Util\PackageSorter;
  19610. class PluginManager
  19611. {
  19612. protected $composer;
  19613. protected $io;
  19614. protected $globalComposer;
  19615. protected $versionParser;
  19616. protected $disablePlugins = false;
  19617. protected $plugins = array();
  19618. protected $registeredPlugins = array();
  19619. private static $classCounter = 0;
  19620. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19621. {
  19622. $this->io = $io;
  19623. $this->composer = $composer;
  19624. $this->globalComposer = $globalComposer;
  19625. $this->versionParser = new VersionParser();
  19626. $this->disablePlugins = $disablePlugins;
  19627. }
  19628. public function loadInstalledPlugins()
  19629. {
  19630. if ($this->disablePlugins) {
  19631. return;
  19632. }
  19633. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19634. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19635. if ($repo) {
  19636. $this->loadRepository($repo);
  19637. }
  19638. if ($globalRepo) {
  19639. $this->loadRepository($globalRepo);
  19640. }
  19641. }
  19642. public function getPlugins()
  19643. {
  19644. return $this->plugins;
  19645. }
  19646. public function getGlobalComposer()
  19647. {
  19648. return $this->globalComposer;
  19649. }
  19650. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19651. {
  19652. if ($this->disablePlugins) {
  19653. return;
  19654. }
  19655. if ($package->getType() === 'composer-plugin') {
  19656. $requiresComposer = null;
  19657. foreach ($package->getRequires() as $link) {
  19658. if ('composer-plugin-api' === $link->getTarget()) {
  19659. $requiresComposer = $link->getConstraint();
  19660. break;
  19661. }
  19662. }
  19663. if (!$requiresComposer) {
  19664. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19665. }
  19666. $currentPluginApiVersion = $this->getPluginApiVersion();
  19667. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19668. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19669. $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>');
  19670. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19671. $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>');
  19672. return;
  19673. }
  19674. }
  19675. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19676. if (in_array($package->getName(), $this->registeredPlugins)) {
  19677. return;
  19678. }
  19679. $extra = $package->getExtra();
  19680. if (empty($extra['class'])) {
  19681. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19682. }
  19683. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19684. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19685. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19686. $pool = new Pool('dev');
  19687. $pool->addRepository($localRepo);
  19688. if ($globalRepo) {
  19689. $pool->addRepository($globalRepo);
  19690. }
  19691. $autoloadPackages = array($package->getName() => $package);
  19692. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19693. $generator = $this->composer->getAutoloadGenerator();
  19694. $autoloads = array();
  19695. foreach ($autoloadPackages as $autoloadPackage) {
  19696. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19697. $autoloads[] = array($autoloadPackage, $downloadPath);
  19698. }
  19699. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19700. $classLoader = $generator->createLoader($map);
  19701. $classLoader->register();
  19702. foreach ($classes as $class) {
  19703. if (class_exists($class, false)) {
  19704. $class = trim($class, '\\');
  19705. $path = $classLoader->findFile($class);
  19706. $code = file_get_contents($path);
  19707. $separatorPos = strrpos($class, '\\');
  19708. $className = $class;
  19709. if ($separatorPos) {
  19710. $className = substr($class, $separatorPos + 1);
  19711. }
  19712. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19713. $code = str_replace('__FILE__', var_export($path, true), $code);
  19714. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19715. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19716. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19717. eval($code);
  19718. $class .= '_composer_tmp'.self::$classCounter;
  19719. self::$classCounter++;
  19720. }
  19721. if ($oldInstallerPlugin) {
  19722. $installer = new $class($this->io, $this->composer);
  19723. $this->composer->getInstallationManager()->addInstaller($installer);
  19724. } elseif (class_exists($class)) {
  19725. $plugin = new $class();
  19726. $this->addPlugin($plugin);
  19727. $this->registeredPlugins[] = $package->getName();
  19728. } elseif ($failOnMissingClasses) {
  19729. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19730. }
  19731. }
  19732. }
  19733. protected function getPluginApiVersion()
  19734. {
  19735. return PluginInterface::PLUGIN_API_VERSION;
  19736. }
  19737. public function addPlugin(PluginInterface $plugin)
  19738. {
  19739. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19740. $this->plugins[] = $plugin;
  19741. $plugin->activate($this->composer, $this->io);
  19742. if ($plugin instanceof EventSubscriberInterface) {
  19743. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19744. }
  19745. }
  19746. private function loadRepository(RepositoryInterface $repo)
  19747. {
  19748. $packages = $repo->getPackages();
  19749. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  19750. foreach ($sortedPackages as $package) {
  19751. if (!($package instanceof CompletePackage)) {
  19752. continue;
  19753. }
  19754. if ('composer-plugin' === $package->getType()) {
  19755. $this->registerPackage($package);
  19756. } elseif ('composer-installer' === $package->getType()) {
  19757. $this->registerPackage($package);
  19758. }
  19759. }
  19760. }
  19761. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19762. {
  19763. $requires = array_merge(
  19764. $package->getRequires(),
  19765. $package->getDevRequires()
  19766. );
  19767. foreach ($requires as $requireLink) {
  19768. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19769. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19770. $collected[$requiredPackage->getName()] = $requiredPackage;
  19771. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19772. }
  19773. }
  19774. return $collected;
  19775. }
  19776. private function lookupInstalledPackage(Pool $pool, Link $link)
  19777. {
  19778. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19779. return !empty($packages) ? $packages[0] : null;
  19780. }
  19781. private function getInstallPath(PackageInterface $package, $global = false)
  19782. {
  19783. if (!$global) {
  19784. return $this->composer->getInstallationManager()->getInstallPath($package);
  19785. }
  19786. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19787. }
  19788. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19789. {
  19790. if (!($plugin instanceof Capable)) {
  19791. return null;
  19792. }
  19793. $capabilities = (array) $plugin->getCapabilities();
  19794. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19795. return trim($capabilities[$capability]);
  19796. }
  19797. if (
  19798. array_key_exists($capability, $capabilities)
  19799. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19800. ) {
  19801. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19802. }
  19803. }
  19804. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19805. {
  19806. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19807. if (!class_exists($capabilityClass)) {
  19808. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19809. }
  19810. $ctorArgs['plugin'] = $plugin;
  19811. $capabilityObj = new $capabilityClass($ctorArgs);
  19812. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19813. throw new \RuntimeException(
  19814. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19815. );
  19816. }
  19817. return $capabilityObj;
  19818. }
  19819. }
  19820. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19821. {
  19822. $capabilities = array();
  19823. foreach ($this->getPlugins() as $plugin) {
  19824. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19825. $capabilities[] = $capability;
  19826. }
  19827. }
  19828. return $capabilities;
  19829. }
  19830. }
  19831. <?php
  19832. namespace Composer\Plugin;
  19833. use Composer\EventDispatcher\Event;
  19834. use Symfony\Component\Console\Input\InputInterface;
  19835. class PreCommandRunEvent extends Event
  19836. {
  19837. private $input;
  19838. private $command;
  19839. public function __construct($name, InputInterface $input, $command)
  19840. {
  19841. parent::__construct($name);
  19842. $this->input = $input;
  19843. $this->command = $command;
  19844. }
  19845. public function getInput()
  19846. {
  19847. return $this->input;
  19848. }
  19849. public function getCommand()
  19850. {
  19851. return $this->command;
  19852. }
  19853. }
  19854. <?php
  19855. namespace Composer\Plugin;
  19856. use Composer\EventDispatcher\Event;
  19857. use Composer\Util\RemoteFilesystem;
  19858. class PreFileDownloadEvent extends Event
  19859. {
  19860. private $rfs;
  19861. private $processedUrl;
  19862. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19863. {
  19864. parent::__construct($name);
  19865. $this->rfs = $rfs;
  19866. $this->processedUrl = $processedUrl;
  19867. }
  19868. public function getRemoteFilesystem()
  19869. {
  19870. return $this->rfs;
  19871. }
  19872. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19873. {
  19874. $this->rfs = $rfs;
  19875. }
  19876. public function getProcessedUrl()
  19877. {
  19878. return $this->processedUrl;
  19879. }
  19880. }
  19881. <?php
  19882. namespace Composer\Question;
  19883. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19884. use Symfony\Component\Console\Question\Question;
  19885. class StrictConfirmationQuestion extends Question
  19886. {
  19887. private $trueAnswerRegex;
  19888. private $falseAnswerRegex;
  19889. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19890. {
  19891. parent::__construct($question, (bool) $default);
  19892. $this->trueAnswerRegex = $trueAnswerRegex;
  19893. $this->falseAnswerRegex = $falseAnswerRegex;
  19894. $this->setNormalizer($this->getDefaultNormalizer());
  19895. $this->setValidator($this->getDefaultValidator());
  19896. }
  19897. private function getDefaultNormalizer()
  19898. {
  19899. $default = $this->getDefault();
  19900. $trueRegex = $this->trueAnswerRegex;
  19901. $falseRegex = $this->falseAnswerRegex;
  19902. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19903. if (is_bool($answer)) {
  19904. return $answer;
  19905. }
  19906. if (empty($answer) && !empty($default)) {
  19907. return $default;
  19908. }
  19909. if (preg_match($trueRegex, $answer)) {
  19910. return true;
  19911. }
  19912. if (preg_match($falseRegex, $answer)) {
  19913. return false;
  19914. }
  19915. return null;
  19916. };
  19917. }
  19918. private function getDefaultValidator()
  19919. {
  19920. return function ($answer) {
  19921. if (!is_bool($answer)) {
  19922. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19923. }
  19924. return $answer;
  19925. };
  19926. }
  19927. }
  19928. <?php
  19929. namespace Composer\Repository;
  19930. use Composer\Package\AliasPackage;
  19931. use Composer\Package\PackageInterface;
  19932. use Composer\Package\CompletePackageInterface;
  19933. use Composer\Package\Version\VersionParser;
  19934. use Composer\Semver\Constraint\ConstraintInterface;
  19935. use Composer\Semver\Constraint\Constraint;
  19936. class ArrayRepository extends BaseRepository
  19937. {
  19938. protected $packages;
  19939. public function __construct(array $packages = array())
  19940. {
  19941. foreach ($packages as $package) {
  19942. $this->addPackage($package);
  19943. }
  19944. }
  19945. public function findPackage($name, $constraint)
  19946. {
  19947. $name = strtolower($name);
  19948. if (!$constraint instanceof ConstraintInterface) {
  19949. $versionParser = new VersionParser();
  19950. $constraint = $versionParser->parseConstraints($constraint);
  19951. }
  19952. foreach ($this->getPackages() as $package) {
  19953. if ($name === $package->getName()) {
  19954. $pkgConstraint = new Constraint('==', $package->getVersion());
  19955. if ($constraint->matches($pkgConstraint)) {
  19956. return $package;
  19957. }
  19958. }
  19959. }
  19960. return null;
  19961. }
  19962. public function findPackages($name, $constraint = null)
  19963. {
  19964. $name = strtolower($name);
  19965. $packages = array();
  19966. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19967. $versionParser = new VersionParser();
  19968. $constraint = $versionParser->parseConstraints($constraint);
  19969. }
  19970. foreach ($this->getPackages() as $package) {
  19971. if ($name === $package->getName()) {
  19972. $pkgConstraint = new Constraint('==', $package->getVersion());
  19973. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19974. $packages[] = $package;
  19975. }
  19976. }
  19977. }
  19978. return $packages;
  19979. }
  19980. public function search($query, $mode = 0, $type = null)
  19981. {
  19982. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19983. $matches = array();
  19984. foreach ($this->getPackages() as $package) {
  19985. $name = $package->getName();
  19986. if (isset($matches[$name])) {
  19987. continue;
  19988. }
  19989. if (preg_match($regex, $name)
  19990. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19991. ) {
  19992. if (null !== $type && $package->getType() !== $type) {
  19993. continue;
  19994. }
  19995. $matches[$name] = array(
  19996. 'name' => $package->getPrettyName(),
  19997. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19998. );
  19999. }
  20000. }
  20001. return array_values($matches);
  20002. }
  20003. public function hasPackage(PackageInterface $package)
  20004. {
  20005. $packageId = $package->getUniqueName();
  20006. foreach ($this->getPackages() as $repoPackage) {
  20007. if ($packageId === $repoPackage->getUniqueName()) {
  20008. return true;
  20009. }
  20010. }
  20011. return false;
  20012. }
  20013. public function addPackage(PackageInterface $package)
  20014. {
  20015. if (null === $this->packages) {
  20016. $this->initialize();
  20017. }
  20018. $package->setRepository($this);
  20019. $this->packages[] = $package;
  20020. if ($package instanceof AliasPackage) {
  20021. $aliasedPackage = $package->getAliasOf();
  20022. if (null === $aliasedPackage->getRepository()) {
  20023. $this->addPackage($aliasedPackage);
  20024. }
  20025. }
  20026. }
  20027. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20028. {
  20029. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20030. }
  20031. public function removePackage(PackageInterface $package)
  20032. {
  20033. $packageId = $package->getUniqueName();
  20034. foreach ($this->getPackages() as $key => $repoPackage) {
  20035. if ($packageId === $repoPackage->getUniqueName()) {
  20036. array_splice($this->packages, $key, 1);
  20037. return;
  20038. }
  20039. }
  20040. }
  20041. public function getPackages()
  20042. {
  20043. if (null === $this->packages) {
  20044. $this->initialize();
  20045. }
  20046. return $this->packages;
  20047. }
  20048. public function count()
  20049. {
  20050. return count($this->packages);
  20051. }
  20052. protected function initialize()
  20053. {
  20054. $this->packages = array();
  20055. }
  20056. }
  20057. <?php
  20058. namespace Composer\Repository;
  20059. use Composer\IO\IOInterface;
  20060. use Composer\Json\JsonFile;
  20061. use Composer\Package\Loader\ArrayLoader;
  20062. use Composer\Package\Loader\LoaderInterface;
  20063. use Composer\Util\Zip;
  20064. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20065. {
  20066. protected $loader;
  20067. protected $lookup;
  20068. protected $repoConfig;
  20069. private $io;
  20070. public function __construct(array $repoConfig, IOInterface $io)
  20071. {
  20072. parent::__construct();
  20073. if (!extension_loaded('zip')) {
  20074. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20075. }
  20076. $this->loader = new ArrayLoader();
  20077. $this->lookup = $repoConfig['url'];
  20078. $this->io = $io;
  20079. $this->repoConfig = $repoConfig;
  20080. }
  20081. public function getRepoConfig()
  20082. {
  20083. return $this->repoConfig;
  20084. }
  20085. protected function initialize()
  20086. {
  20087. parent::initialize();
  20088. $this->scanDirectory($this->lookup);
  20089. }
  20090. private function scanDirectory($path)
  20091. {
  20092. $io = $this->io;
  20093. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20094. $iterator = new \RecursiveIteratorIterator($directory);
  20095. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20096. foreach ($regex as $file) {
  20097. if (!$file->isFile()) {
  20098. continue;
  20099. }
  20100. $package = $this->getComposerInformation($file);
  20101. if (!$package) {
  20102. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20103. continue;
  20104. }
  20105. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20106. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20107. $this->addPackage($package);
  20108. }
  20109. }
  20110. private function getComposerInformation(\SplFileInfo $file)
  20111. {
  20112. $json = Zip::getComposerJson($file->getPathname());
  20113. if (null === $json) {
  20114. return false;
  20115. }
  20116. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20117. $package['dist'] = array(
  20118. 'type' => 'zip',
  20119. 'url' => strtr($file->getPathname(), '\\', '/'),
  20120. 'shasum' => sha1_file($file->getRealPath()),
  20121. );
  20122. try {
  20123. $package = $this->loader->load($package);
  20124. } catch (\UnexpectedValueException $e) {
  20125. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20126. }
  20127. return $package;
  20128. }
  20129. }
  20130. <?php
  20131. namespace Composer\Repository;
  20132. use Composer\Package\RootPackageInterface;
  20133. use Composer\Semver\Constraint\ConstraintInterface;
  20134. use Composer\Semver\Constraint\Constraint;
  20135. use Composer\Package\Link;
  20136. abstract class BaseRepository implements RepositoryInterface
  20137. {
  20138. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20139. {
  20140. $needles = array_map('strtolower', (array) $needle);
  20141. $results = array();
  20142. if (null === $packagesFound) {
  20143. $packagesFound = $needles;
  20144. }
  20145. $rootPackage = null;
  20146. foreach ($this->getPackages() as $package) {
  20147. if ($package instanceof RootPackageInterface) {
  20148. $rootPackage = $package;
  20149. break;
  20150. }
  20151. }
  20152. foreach ($this->getPackages() as $package) {
  20153. $links = $package->getRequires();
  20154. $packagesInTree = $packagesFound;
  20155. if (!$invert) {
  20156. $links += $package->getReplaces();
  20157. }
  20158. if ($package instanceof RootPackageInterface) {
  20159. $links += $package->getDevRequires();
  20160. }
  20161. foreach ($links as $link) {
  20162. foreach ($needles as $needle) {
  20163. if ($link->getTarget() === $needle) {
  20164. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20165. if (in_array($link->getSource(), $packagesInTree)) {
  20166. $results[$link->getSource()] = array($package, $link, false);
  20167. continue;
  20168. }
  20169. $packagesInTree[] = $link->getSource();
  20170. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20171. $results[$link->getSource()] = array($package, $link, $dependents);
  20172. }
  20173. }
  20174. }
  20175. }
  20176. if ($invert && in_array($package->getName(), $needles)) {
  20177. foreach ($package->getConflicts() as $link) {
  20178. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20179. $version = new Constraint('=', $pkg->getVersion());
  20180. if ($link->getConstraint()->matches($version) === $invert) {
  20181. $results[] = array($package, $link, false);
  20182. }
  20183. }
  20184. }
  20185. }
  20186. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  20187. foreach ($package->getRequires() as $link) {
  20188. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  20189. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  20190. continue;
  20191. }
  20192. $platformPkg = $this->findPackage($link->getTarget(), '*');
  20193. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  20194. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  20195. continue;
  20196. }
  20197. foreach ($this->getPackages() as $pkg) {
  20198. if (!in_array($link->getTarget(), $pkg->getNames())) {
  20199. continue;
  20200. }
  20201. $version = new Constraint('=', $pkg->getVersion());
  20202. if (!$link->getConstraint()->matches($version)) {
  20203. if ($rootPackage) {
  20204. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  20205. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  20206. $results[] = array($package, $link, false);
  20207. $results[] = array($rootPackage, $rootReq, false);
  20208. continue 3;
  20209. }
  20210. }
  20211. $results[] = array($package, $link, false);
  20212. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  20213. } else {
  20214. $results[] = array($package, $link, false);
  20215. }
  20216. }
  20217. continue 2;
  20218. }
  20219. }
  20220. }
  20221. }
  20222. ksort($results);
  20223. return $results;
  20224. }
  20225. }
  20226. <?php
  20227. namespace Composer\Repository;
  20228. use Composer\Package\Loader\ArrayLoader;
  20229. use Composer\Package\PackageInterface;
  20230. use Composer\Package\AliasPackage;
  20231. use Composer\Package\Version\VersionParser;
  20232. use Composer\DependencyResolver\Pool;
  20233. use Composer\Json\JsonFile;
  20234. use Composer\Cache;
  20235. use Composer\Config;
  20236. use Composer\Composer;
  20237. use Composer\Factory;
  20238. use Composer\IO\IOInterface;
  20239. use Composer\Util\RemoteFilesystem;
  20240. use Composer\Plugin\PluginEvents;
  20241. use Composer\Plugin\PreFileDownloadEvent;
  20242. use Composer\EventDispatcher\EventDispatcher;
  20243. use Composer\Downloader\TransportException;
  20244. use Composer\Semver\Constraint\ConstraintInterface;
  20245. use Composer\Semver\Constraint\Constraint;
  20246. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20247. {
  20248. protected $config;
  20249. protected $repoConfig;
  20250. protected $options;
  20251. protected $url;
  20252. protected $baseUrl;
  20253. protected $io;
  20254. protected $rfs;
  20255. protected $cache;
  20256. protected $notifyUrl;
  20257. protected $searchUrl;
  20258. protected $hasProviders = false;
  20259. protected $providersUrl;
  20260. protected $lazyProvidersUrl;
  20261. protected $providerListing;
  20262. protected $providers = array();
  20263. protected $providersByUid = array();
  20264. protected $loader;
  20265. protected $rootAliases;
  20266. protected $allowSslDowngrade = false;
  20267. protected $eventDispatcher;
  20268. protected $sourceMirrors;
  20269. protected $distMirrors;
  20270. private $degradedMode = false;
  20271. private $rootData;
  20272. private $hasPartialPackages;
  20273. private $partialPackagesByName;
  20274. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20275. {
  20276. parent::__construct();
  20277. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  20278. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20279. }
  20280. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  20281. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  20282. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  20283. }
  20284. $urlBits = parse_url($repoConfig['url']);
  20285. if ($urlBits === false || empty($urlBits['scheme'])) {
  20286. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  20287. }
  20288. if (!isset($repoConfig['options'])) {
  20289. $repoConfig['options'] = array();
  20290. }
  20291. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  20292. $this->allowSslDowngrade = true;
  20293. }
  20294. $this->config = $config;
  20295. $this->options = $repoConfig['options'];
  20296. $this->url = $repoConfig['url'];
  20297. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  20298. $this->url = $match['proto'].'://repo.packagist.org';
  20299. }
  20300. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  20301. $this->io = $io;
  20302. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  20303. $this->loader = new ArrayLoader();
  20304. if ($rfs && $this->options) {
  20305. $rfs = clone $rfs;
  20306. $rfs->setOptions($this->options);
  20307. }
  20308. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  20309. $this->eventDispatcher = $eventDispatcher;
  20310. $this->repoConfig = $repoConfig;
  20311. }
  20312. public function getRepoConfig()
  20313. {
  20314. return $this->repoConfig;
  20315. }
  20316. public function setRootAliases(array $rootAliases)
  20317. {
  20318. $this->rootAliases = $rootAliases;
  20319. }
  20320. public function findPackage($name, $constraint)
  20321. {
  20322. if (!$this->hasProviders()) {
  20323. return parent::findPackage($name, $constraint);
  20324. }
  20325. $name = strtolower($name);
  20326. if (!$constraint instanceof ConstraintInterface) {
  20327. $versionParser = new VersionParser();
  20328. $constraint = $versionParser->parseConstraints($constraint);
  20329. }
  20330. foreach ($this->getProviderNames() as $providerName) {
  20331. if ($name === $providerName) {
  20332. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  20333. foreach ($packages as $package) {
  20334. if ($name === $package->getName()) {
  20335. $pkgConstraint = new Constraint('==', $package->getVersion());
  20336. if ($constraint->matches($pkgConstraint)) {
  20337. return $package;
  20338. }
  20339. }
  20340. }
  20341. break;
  20342. }
  20343. }
  20344. }
  20345. public function findPackages($name, $constraint = null)
  20346. {
  20347. if (!$this->hasProviders()) {
  20348. return parent::findPackages($name, $constraint);
  20349. }
  20350. $name = strtolower($name);
  20351. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20352. $versionParser = new VersionParser();
  20353. $constraint = $versionParser->parseConstraints($constraint);
  20354. }
  20355. $packages = array();
  20356. foreach ($this->getProviderNames() as $providerName) {
  20357. if ($name === $providerName) {
  20358. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  20359. foreach ($candidates as $package) {
  20360. if ($name === $package->getName()) {
  20361. $pkgConstraint = new Constraint('==', $package->getVersion());
  20362. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20363. $packages[] = $package;
  20364. }
  20365. }
  20366. }
  20367. break;
  20368. }
  20369. }
  20370. return $packages;
  20371. }
  20372. public function getPackages()
  20373. {
  20374. if ($this->hasProviders()) {
  20375. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20376. }
  20377. return parent::getPackages();
  20378. }
  20379. public function search($query, $mode = 0, $type = null)
  20380. {
  20381. $this->loadRootServerFile();
  20382. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20383. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20384. $origin = RemoteFilesystem::getOrigin($url);
  20385. $json = $this->rfs->getContents($origin, $url, false);
  20386. $search = JsonFile::parseJson($json, $url);
  20387. if (empty($search['results'])) {
  20388. return array();
  20389. }
  20390. $results = array();
  20391. foreach ($search['results'] as $result) {
  20392. if (empty($result['virtual'])) {
  20393. $results[] = $result;
  20394. }
  20395. }
  20396. return $results;
  20397. }
  20398. if ($this->hasProviders()) {
  20399. $results = array();
  20400. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20401. foreach ($this->getProviderNames() as $name) {
  20402. if (preg_match($regex, $name)) {
  20403. $results[] = array('name' => $name);
  20404. }
  20405. }
  20406. return $results;
  20407. }
  20408. return parent::search($query, $mode);
  20409. }
  20410. public function getProviderNames()
  20411. {
  20412. $this->loadRootServerFile();
  20413. if (null === $this->providerListing) {
  20414. $this->loadProviderListings($this->loadRootServerFile());
  20415. }
  20416. if ($this->lazyProvidersUrl) {
  20417. return array();
  20418. }
  20419. if ($this->providersUrl) {
  20420. return array_keys($this->providerListing);
  20421. }
  20422. return array();
  20423. }
  20424. protected function configurePackageTransportOptions(PackageInterface $package)
  20425. {
  20426. foreach ($package->getDistUrls() as $url) {
  20427. if (strpos($url, $this->baseUrl) === 0) {
  20428. $package->setTransportOptions($this->options);
  20429. return;
  20430. }
  20431. }
  20432. }
  20433. public function hasProviders()
  20434. {
  20435. $this->loadRootServerFile();
  20436. return $this->hasProviders;
  20437. }
  20438. public function resetPackageIds()
  20439. {
  20440. foreach ($this->providersByUid as $package) {
  20441. if ($package instanceof AliasPackage) {
  20442. $package->getAliasOf()->setId(-1);
  20443. }
  20444. $package->setId(-1);
  20445. }
  20446. }
  20447. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20448. {
  20449. if (isset($this->providers[$name]) && !$bypassFilters) {
  20450. return $this->providers[$name];
  20451. }
  20452. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20453. $this->initializePartialPackages();
  20454. }
  20455. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20456. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20457. return array();
  20458. }
  20459. if (null === $this->providerListing) {
  20460. $this->loadProviderListings($this->loadRootServerFile());
  20461. }
  20462. $useLastModifiedCheck = false;
  20463. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20464. $hash = null;
  20465. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20466. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20467. $useLastModifiedCheck = true;
  20468. } elseif ($this->providersUrl) {
  20469. if (!isset($this->providerListing[$name])) {
  20470. return array();
  20471. }
  20472. $hash = $this->providerListing[$name]['sha256'];
  20473. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20474. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20475. } else {
  20476. return array();
  20477. }
  20478. $packages = null;
  20479. if ($cacheKey) {
  20480. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20481. $packages = json_decode($this->cache->read($cacheKey), true);
  20482. } elseif ($useLastModifiedCheck) {
  20483. if ($contents = $this->cache->read($cacheKey)) {
  20484. $contents = json_decode($contents, true);
  20485. if (isset($contents['last-modified'])) {
  20486. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20487. if (true === $response) {
  20488. $packages = $contents;
  20489. } elseif ($response) {
  20490. $packages = $response;
  20491. }
  20492. }
  20493. }
  20494. }
  20495. }
  20496. if (!$packages) {
  20497. try {
  20498. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20499. } catch (TransportException $e) {
  20500. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20501. $packages = array('packages' => array());
  20502. } else {
  20503. throw $e;
  20504. }
  20505. }
  20506. }
  20507. $loadingPartialPackage = false;
  20508. } else {
  20509. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20510. $loadingPartialPackage = true;
  20511. }
  20512. $this->providers[$name] = array();
  20513. foreach ($packages['packages'] as $versions) {
  20514. foreach ($versions as $version) {
  20515. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20516. continue;
  20517. }
  20518. if (isset($this->providersByUid[$version['uid']])) {
  20519. if (!isset($this->providers[$name][$version['uid']])) {
  20520. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20521. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20522. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20523. } else {
  20524. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20525. }
  20526. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20527. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20528. }
  20529. }
  20530. } else {
  20531. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20532. continue;
  20533. }
  20534. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20535. $package->setRepository($this);
  20536. if ($package instanceof AliasPackage) {
  20537. $aliased = $package->getAliasOf();
  20538. $aliased->setRepository($this);
  20539. $this->providers[$name][$version['uid']] = $aliased;
  20540. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20541. $this->providersByUid[$version['uid']] = $package;
  20542. } else {
  20543. $this->providers[$name][$version['uid']] = $package;
  20544. $this->providersByUid[$version['uid']] = $package;
  20545. }
  20546. unset($rootAliasData);
  20547. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20548. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20549. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20550. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20551. }
  20552. if (isset($rootAliasData)) {
  20553. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20554. $alias->setRepository($this);
  20555. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20556. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20557. }
  20558. }
  20559. }
  20560. }
  20561. $result = $this->providers[$name];
  20562. if ($bypassFilters) {
  20563. foreach ($this->providers[$name] as $uid => $provider) {
  20564. unset($this->providersByUid[$uid]);
  20565. }
  20566. unset($this->providers[$name]);
  20567. }
  20568. return $result;
  20569. }
  20570. protected function initialize()
  20571. {
  20572. parent::initialize();
  20573. $repoData = $this->loadDataFromServer();
  20574. foreach ($repoData as $package) {
  20575. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20576. }
  20577. }
  20578. public function addPackage(PackageInterface $package)
  20579. {
  20580. parent::addPackage($package);
  20581. $this->configurePackageTransportOptions($package);
  20582. }
  20583. protected function loadRootServerFile()
  20584. {
  20585. if (null !== $this->rootData) {
  20586. return $this->rootData;
  20587. }
  20588. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20589. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20590. }
  20591. $jsonUrlParts = parse_url($this->url);
  20592. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20593. $jsonUrl = $this->url;
  20594. } else {
  20595. $jsonUrl = $this->url . '/packages.json';
  20596. }
  20597. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20598. if (!empty($data['notify-batch'])) {
  20599. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20600. } elseif (!empty($data['notify'])) {
  20601. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20602. }
  20603. if (!empty($data['search'])) {
  20604. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20605. }
  20606. if (!empty($data['mirrors'])) {
  20607. foreach ($data['mirrors'] as $mirror) {
  20608. if (!empty($mirror['git-url'])) {
  20609. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20610. }
  20611. if (!empty($mirror['hg-url'])) {
  20612. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20613. }
  20614. if (!empty($mirror['dist-url'])) {
  20615. $this->distMirrors[] = array(
  20616. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20617. 'preferred' => !empty($mirror['preferred']),
  20618. );
  20619. }
  20620. }
  20621. }
  20622. if (!empty($data['providers-lazy-url'])) {
  20623. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20624. $this->hasProviders = true;
  20625. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20626. }
  20627. if ($this->allowSslDowngrade) {
  20628. $this->url = str_replace('https://', 'http://', $this->url);
  20629. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20630. }
  20631. if (!empty($data['providers-url'])) {
  20632. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20633. $this->hasProviders = true;
  20634. }
  20635. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20636. $this->hasProviders = true;
  20637. }
  20638. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20639. $this->url = 'https://repo.packagist.org';
  20640. $this->baseUrl = 'https://repo.packagist.org';
  20641. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20642. $this->providersUrl = null;
  20643. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20644. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20645. $this->providersUrl = null;
  20646. }
  20647. return $this->rootData = $data;
  20648. }
  20649. protected function canonicalizeUrl($url)
  20650. {
  20651. if ('/' === $url[0]) {
  20652. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  20653. return $matches[0] . $url;
  20654. }
  20655. return $this->url;
  20656. }
  20657. return $url;
  20658. }
  20659. protected function loadDataFromServer()
  20660. {
  20661. $data = $this->loadRootServerFile();
  20662. return $this->loadIncludes($data);
  20663. }
  20664. protected function loadProviderListings($data)
  20665. {
  20666. if (isset($data['providers'])) {
  20667. if (!is_array($this->providerListing)) {
  20668. $this->providerListing = array();
  20669. }
  20670. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20671. }
  20672. if ($this->providersUrl && isset($data['provider-includes'])) {
  20673. $includes = $data['provider-includes'];
  20674. foreach ($includes as $include => $metadata) {
  20675. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20676. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20677. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20678. $includedData = json_decode($this->cache->read($cacheKey), true);
  20679. } else {
  20680. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20681. }
  20682. $this->loadProviderListings($includedData);
  20683. }
  20684. }
  20685. }
  20686. protected function loadIncludes($data)
  20687. {
  20688. $packages = array();
  20689. if (!isset($data['packages']) && !isset($data['includes'])) {
  20690. foreach ($data as $pkg) {
  20691. foreach ($pkg['versions'] as $metadata) {
  20692. $packages[] = $metadata;
  20693. }
  20694. }
  20695. return $packages;
  20696. }
  20697. if (isset($data['packages'])) {
  20698. foreach ($data['packages'] as $package => $versions) {
  20699. foreach ($versions as $version => $metadata) {
  20700. $packages[] = $metadata;
  20701. }
  20702. }
  20703. }
  20704. if (isset($data['includes'])) {
  20705. foreach ($data['includes'] as $include => $metadata) {
  20706. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20707. $includedData = json_decode($this->cache->read($include), true);
  20708. } else {
  20709. $includedData = $this->fetchFile($include);
  20710. }
  20711. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20712. }
  20713. }
  20714. return $packages;
  20715. }
  20716. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20717. {
  20718. try {
  20719. if (!isset($data['notification-url'])) {
  20720. $data['notification-url'] = $this->notifyUrl;
  20721. }
  20722. $package = $this->loader->load($data, $class);
  20723. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20724. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20725. }
  20726. $package->setDistMirrors($this->distMirrors);
  20727. $this->configurePackageTransportOptions($package);
  20728. return $package;
  20729. } catch (\Exception $e) {
  20730. 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);
  20731. }
  20732. }
  20733. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20734. {
  20735. if (null === $cacheKey) {
  20736. $cacheKey = $filename;
  20737. $filename = $this->baseUrl.'/'.$filename;
  20738. }
  20739. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20740. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20741. }
  20742. $retries = 3;
  20743. while ($retries--) {
  20744. try {
  20745. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20746. if ($this->eventDispatcher) {
  20747. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20748. }
  20749. $origin = RemoteFilesystem::getOrigin($filename);
  20750. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20751. $json = $rfs->getContents($origin, $filename, false);
  20752. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20753. if ($this->allowSslDowngrade) {
  20754. $this->url = str_replace('http://', 'https://', $this->url);
  20755. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20756. $filename = str_replace('http://', 'https://', $filename);
  20757. }
  20758. if ($retries) {
  20759. usleep(100000);
  20760. continue;
  20761. }
  20762. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  20763. }
  20764. $data = JsonFile::parseJson($json, $filename);
  20765. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20766. if ($cacheKey) {
  20767. if ($storeLastModifiedTime) {
  20768. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20769. if ($lastModifiedDate) {
  20770. $data['last-modified'] = $lastModifiedDate;
  20771. $json = json_encode($data);
  20772. }
  20773. }
  20774. $this->cache->write($cacheKey, $json);
  20775. }
  20776. break;
  20777. } catch (\Exception $e) {
  20778. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20779. throw $e;
  20780. }
  20781. if ($retries) {
  20782. usleep(100000);
  20783. continue;
  20784. }
  20785. if ($e instanceof RepositorySecurityException) {
  20786. throw $e;
  20787. }
  20788. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20789. if (!$this->degradedMode) {
  20790. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20791. $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>');
  20792. }
  20793. $this->degradedMode = true;
  20794. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20795. break;
  20796. }
  20797. throw $e;
  20798. }
  20799. }
  20800. return $data;
  20801. }
  20802. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20803. {
  20804. $retries = 3;
  20805. while ($retries--) {
  20806. try {
  20807. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20808. if ($this->eventDispatcher) {
  20809. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20810. }
  20811. $origin = RemoteFilesystem::getOrigin($filename);
  20812. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20813. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20814. $json = $rfs->getContents($origin, $filename, false, $options);
  20815. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20816. return true;
  20817. }
  20818. $data = JsonFile::parseJson($json, $filename);
  20819. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20820. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20821. if ($lastModifiedDate) {
  20822. $data['last-modified'] = $lastModifiedDate;
  20823. $json = json_encode($data);
  20824. }
  20825. $this->cache->write($cacheKey, $json);
  20826. return $data;
  20827. } catch (\Exception $e) {
  20828. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20829. throw $e;
  20830. }
  20831. if ($retries) {
  20832. usleep(100000);
  20833. continue;
  20834. }
  20835. if (!$this->degradedMode) {
  20836. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20837. $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>');
  20838. }
  20839. $this->degradedMode = true;
  20840. return true;
  20841. }
  20842. }
  20843. }
  20844. private function initializePartialPackages()
  20845. {
  20846. $rootData = $this->loadRootServerFile();
  20847. $this->partialPackagesByName = array();
  20848. foreach ($rootData['packages'] as $package => $versions) {
  20849. $package = strtolower($package);
  20850. foreach ($versions as $version) {
  20851. $this->partialPackagesByName[$package][] = $version;
  20852. if (!empty($version['provide']) && is_array($version['provide'])) {
  20853. foreach ($version['provide'] as $provided => $providedVersion) {
  20854. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20855. }
  20856. }
  20857. if (!empty($version['replace']) && is_array($version['replace'])) {
  20858. foreach ($version['replace'] as $provided => $providedVersion) {
  20859. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20860. }
  20861. }
  20862. }
  20863. }
  20864. $this->rootData = true;
  20865. }
  20866. }
  20867. <?php
  20868. namespace Composer\Repository;
  20869. use Composer\Package\PackageInterface;
  20870. class CompositeRepository extends BaseRepository
  20871. {
  20872. private $repositories;
  20873. public function __construct(array $repositories)
  20874. {
  20875. $this->repositories = array();
  20876. foreach ($repositories as $repo) {
  20877. $this->addRepository($repo);
  20878. }
  20879. }
  20880. public function getRepositories()
  20881. {
  20882. return $this->repositories;
  20883. }
  20884. public function hasPackage(PackageInterface $package)
  20885. {
  20886. foreach ($this->repositories as $repository) {
  20887. if ($repository->hasPackage($package)) {
  20888. return true;
  20889. }
  20890. }
  20891. return false;
  20892. }
  20893. public function findPackage($name, $constraint)
  20894. {
  20895. foreach ($this->repositories as $repository) {
  20896. $package = $repository->findPackage($name, $constraint);
  20897. if (null !== $package) {
  20898. return $package;
  20899. }
  20900. }
  20901. return null;
  20902. }
  20903. public function findPackages($name, $constraint = null)
  20904. {
  20905. $packages = array();
  20906. foreach ($this->repositories as $repository) {
  20907. $packages[] = $repository->findPackages($name, $constraint);
  20908. }
  20909. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20910. }
  20911. public function search($query, $mode = 0, $type = null)
  20912. {
  20913. $matches = array();
  20914. foreach ($this->repositories as $repository) {
  20915. $matches[] = $repository->search($query, $mode, $type);
  20916. }
  20917. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20918. }
  20919. public function getPackages()
  20920. {
  20921. $packages = array();
  20922. foreach ($this->repositories as $repository) {
  20923. $packages[] = $repository->getPackages();
  20924. }
  20925. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20926. }
  20927. public function removePackage(PackageInterface $package)
  20928. {
  20929. foreach ($this->repositories as $repository) {
  20930. $repository->removePackage($package);
  20931. }
  20932. }
  20933. public function count()
  20934. {
  20935. $total = 0;
  20936. foreach ($this->repositories as $repository) {
  20937. $total += $repository->count();
  20938. }
  20939. return $total;
  20940. }
  20941. public function addRepository(RepositoryInterface $repository)
  20942. {
  20943. if ($repository instanceof self) {
  20944. foreach ($repository->getRepositories() as $repo) {
  20945. $this->addRepository($repo);
  20946. }
  20947. } else {
  20948. $this->repositories[] = $repository;
  20949. }
  20950. }
  20951. }
  20952. <?php
  20953. namespace Composer\Repository;
  20954. interface ConfigurableRepositoryInterface
  20955. {
  20956. public function getRepoConfig();
  20957. }
  20958. <?php
  20959. namespace Composer\Repository;
  20960. use Composer\Json\JsonFile;
  20961. use Composer\Package\Loader\ArrayLoader;
  20962. use Composer\Package\Dumper\ArrayDumper;
  20963. class FilesystemRepository extends WritableArrayRepository
  20964. {
  20965. private $file;
  20966. public function __construct(JsonFile $repositoryFile)
  20967. {
  20968. parent::__construct();
  20969. $this->file = $repositoryFile;
  20970. }
  20971. protected function initialize()
  20972. {
  20973. parent::initialize();
  20974. if (!$this->file->exists()) {
  20975. return;
  20976. }
  20977. try {
  20978. $packages = $this->file->read();
  20979. if (isset($packages['packages'])) {
  20980. $packages = $packages['packages'];
  20981. }
  20982. if (!is_array($packages)) {
  20983. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20984. }
  20985. } catch (\Exception $e) {
  20986. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20987. }
  20988. $loader = new ArrayLoader(null, true);
  20989. foreach ($packages as $packageData) {
  20990. $package = $loader->load($packageData);
  20991. $this->addPackage($package);
  20992. }
  20993. }
  20994. public function reload()
  20995. {
  20996. $this->packages = null;
  20997. $this->initialize();
  20998. }
  20999. public function write()
  21000. {
  21001. $data = array();
  21002. $dumper = new ArrayDumper();
  21003. foreach ($this->getCanonicalPackages() as $package) {
  21004. $data[] = $dumper->dump($package);
  21005. }
  21006. usort($data, function ($a, $b) {
  21007. return strcmp($a['name'], $b['name']);
  21008. });
  21009. $this->file->write($data);
  21010. }
  21011. }
  21012. <?php
  21013. namespace Composer\Repository;
  21014. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21015. {
  21016. }
  21017. <?php
  21018. namespace Composer\Repository;
  21019. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21020. {
  21021. }
  21022. <?php
  21023. namespace Composer\Repository;
  21024. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21025. {
  21026. }
  21027. <?php
  21028. namespace Composer\Repository;
  21029. class InvalidRepositoryException extends \Exception
  21030. {
  21031. }
  21032. <?php
  21033. namespace Composer\Repository;
  21034. use Composer\Package\Loader\ArrayLoader;
  21035. use Composer\Package\Loader\ValidatingArrayLoader;
  21036. class PackageRepository extends ArrayRepository
  21037. {
  21038. private $config;
  21039. public function __construct(array $config)
  21040. {
  21041. parent::__construct();
  21042. $this->config = $config['package'];
  21043. if (!is_numeric(key($this->config))) {
  21044. $this->config = array($this->config);
  21045. }
  21046. }
  21047. protected function initialize()
  21048. {
  21049. parent::initialize();
  21050. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21051. foreach ($this->config as $package) {
  21052. try {
  21053. $package = $loader->load($package);
  21054. } catch (\Exception $e) {
  21055. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21056. }
  21057. $this->addPackage($package);
  21058. }
  21059. }
  21060. }
  21061. <?php
  21062. namespace Composer\Repository;
  21063. use Composer\Config;
  21064. use Composer\IO\IOInterface;
  21065. use Composer\Json\JsonFile;
  21066. use Composer\Package\Loader\ArrayLoader;
  21067. use Composer\Package\Version\VersionGuesser;
  21068. use Composer\Package\Version\VersionParser;
  21069. use Composer\Util\Platform;
  21070. use Composer\Util\ProcessExecutor;
  21071. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21072. {
  21073. private $loader;
  21074. private $versionGuesser;
  21075. private $url;
  21076. private $repoConfig;
  21077. private $process;
  21078. private $options;
  21079. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21080. {
  21081. if (!isset($repoConfig['url'])) {
  21082. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21083. }
  21084. $this->loader = new ArrayLoader(null, true);
  21085. $this->url = Platform::expandPath($repoConfig['url']);
  21086. $this->process = new ProcessExecutor($io);
  21087. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21088. $this->repoConfig = $repoConfig;
  21089. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21090. parent::__construct();
  21091. }
  21092. public function getRepoConfig()
  21093. {
  21094. return $this->repoConfig;
  21095. }
  21096. protected function initialize()
  21097. {
  21098. parent::initialize();
  21099. foreach ($this->getUrlMatches() as $url) {
  21100. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21101. $composerFilePath = $path.'composer.json';
  21102. if (!file_exists($composerFilePath)) {
  21103. continue;
  21104. }
  21105. $json = file_get_contents($composerFilePath);
  21106. $package = JsonFile::parseJson($json, $composerFilePath);
  21107. $package['dist'] = array(
  21108. 'type' => 'path',
  21109. 'url' => $url,
  21110. 'reference' => sha1($json . serialize($this->options)),
  21111. );
  21112. $package['transport-options'] = $this->options;
  21113. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21114. if (
  21115. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21116. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21117. && $ref1 === $ref2
  21118. ) {
  21119. $package['version'] = $rootVersion;
  21120. }
  21121. }
  21122. if (!isset($package['version'])) {
  21123. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21124. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  21125. }
  21126. $output = '';
  21127. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  21128. $package['dist']['reference'] = trim($output);
  21129. }
  21130. $package = $this->loader->load($package);
  21131. $this->addPackage($package);
  21132. }
  21133. }
  21134. private function getUrlMatches()
  21135. {
  21136. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21137. if (defined('GLOB_BRACE')) {
  21138. $flags |= GLOB_BRACE;
  21139. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21140. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21141. }
  21142. return array_map(function ($val) {
  21143. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21144. }, glob($this->url, $flags));
  21145. }
  21146. }
  21147. <?php
  21148. namespace Composer\Repository\Pear;
  21149. use Composer\Util\RemoteFilesystem;
  21150. abstract class BaseChannelReader
  21151. {
  21152. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  21153. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  21154. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  21155. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  21156. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  21157. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  21158. private $rfs;
  21159. protected function __construct(RemoteFilesystem $rfs)
  21160. {
  21161. $this->rfs = $rfs;
  21162. }
  21163. protected function requestContent($origin, $path)
  21164. {
  21165. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  21166. $content = $this->rfs->getContents($origin, $url, false);
  21167. if (!$content) {
  21168. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  21169. }
  21170. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  21171. }
  21172. protected function requestXml($origin, $path)
  21173. {
  21174. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  21175. if (false === $xml) {
  21176. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  21177. }
  21178. return $xml;
  21179. }
  21180. }
  21181. <?php
  21182. namespace Composer\Repository\Pear;
  21183. class ChannelInfo
  21184. {
  21185. private $name;
  21186. private $alias;
  21187. private $packages;
  21188. public function __construct($name, $alias, array $packages)
  21189. {
  21190. $this->name = $name;
  21191. $this->alias = $alias;
  21192. $this->packages = $packages;
  21193. }
  21194. public function getName()
  21195. {
  21196. return $this->name;
  21197. }
  21198. public function getAlias()
  21199. {
  21200. return $this->alias;
  21201. }
  21202. public function getPackages()
  21203. {
  21204. return $this->packages;
  21205. }
  21206. }
  21207. <?php
  21208. namespace Composer\Repository\Pear;
  21209. use Composer\Util\RemoteFilesystem;
  21210. class ChannelReader extends BaseChannelReader
  21211. {
  21212. private $readerMap;
  21213. public function __construct(RemoteFilesystem $rfs)
  21214. {
  21215. parent::__construct($rfs);
  21216. $rest10reader = new ChannelRest10Reader($rfs);
  21217. $rest11reader = new ChannelRest11Reader($rfs);
  21218. $this->readerMap = array(
  21219. 'REST1.3' => $rest11reader,
  21220. 'REST1.2' => $rest11reader,
  21221. 'REST1.1' => $rest11reader,
  21222. 'REST1.0' => $rest10reader,
  21223. );
  21224. }
  21225. public function read($url)
  21226. {
  21227. $xml = $this->requestXml($url, "/channel.xml");
  21228. $channelName = (string) $xml->name;
  21229. $channelAlias = (string) $xml->suggestedalias;
  21230. $supportedVersions = array_keys($this->readerMap);
  21231. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  21232. if (!$selectedRestVersion) {
  21233. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  21234. }
  21235. $reader = $this->readerMap[$selectedRestVersion['version']];
  21236. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  21237. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  21238. }
  21239. private function selectRestVersion($channelXml, $supportedVersions)
  21240. {
  21241. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  21242. foreach ($supportedVersions as $version) {
  21243. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  21244. $testResult = $channelXml->xpath($xpathTest);
  21245. foreach ($testResult as $result) {
  21246. $result = (string) $result;
  21247. if (preg_match('{^https://}i', $result)) {
  21248. return array('version' => $version, 'baseUrl' => $result);
  21249. }
  21250. }
  21251. if (count($testResult) > 0) {
  21252. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  21253. }
  21254. }
  21255. return null;
  21256. }
  21257. }
  21258. <?php
  21259. namespace Composer\Repository\Pear;
  21260. use Composer\Downloader\TransportException;
  21261. class ChannelRest10Reader extends BaseChannelReader
  21262. {
  21263. private $dependencyReader;
  21264. public function __construct($rfs)
  21265. {
  21266. parent::__construct($rfs);
  21267. $this->dependencyReader = new PackageDependencyParser();
  21268. }
  21269. public function read($baseUrl)
  21270. {
  21271. return $this->readPackages($baseUrl);
  21272. }
  21273. private function readPackages($baseUrl)
  21274. {
  21275. $result = array();
  21276. $xmlPath = '/p/packages.xml';
  21277. $xml = $this->requestXml($baseUrl, $xmlPath);
  21278. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  21279. foreach ($xml->xpath('ns:p') as $node) {
  21280. $packageName = (string) $node;
  21281. $packageInfo = $this->readPackage($baseUrl, $packageName);
  21282. $result[] = $packageInfo;
  21283. }
  21284. return $result;
  21285. }
  21286. private function readPackage($baseUrl, $packageName)
  21287. {
  21288. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  21289. $xml = $this->requestXml($baseUrl, $xmlPath);
  21290. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  21291. $channelName = (string) $xml->c;
  21292. $packageName = (string) $xml->n;
  21293. $license = (string) $xml->l;
  21294. $shortDescription = (string) $xml->s;
  21295. $description = (string) $xml->d;
  21296. return new PackageInfo(
  21297. $channelName,
  21298. $packageName,
  21299. $license,
  21300. $shortDescription,
  21301. $description,
  21302. $this->readPackageReleases($baseUrl, $packageName)
  21303. );
  21304. }
  21305. private function readPackageReleases($baseUrl, $packageName)
  21306. {
  21307. $result = array();
  21308. try {
  21309. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  21310. $xml = $this->requestXml($baseUrl, $xmlPath);
  21311. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  21312. foreach ($xml->xpath('ns:r') as $node) {
  21313. $releaseVersion = (string) $node->v;
  21314. $releaseStability = (string) $node->s;
  21315. try {
  21316. $result[$releaseVersion] = new ReleaseInfo(
  21317. $releaseStability,
  21318. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  21319. );
  21320. } catch (TransportException $exception) {
  21321. if ($exception->getCode() != 404) {
  21322. throw $exception;
  21323. }
  21324. }
  21325. }
  21326. } catch (TransportException $exception) {
  21327. if ($exception->getCode() != 404) {
  21328. throw $exception;
  21329. }
  21330. }
  21331. return $result;
  21332. }
  21333. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  21334. {
  21335. $dependencyReader = new PackageDependencyParser();
  21336. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  21337. $content = $this->requestContent($baseUrl, $depthPath);
  21338. $dependencyArray = unserialize($content);
  21339. return $dependencyReader->buildDependencyInfo($dependencyArray);
  21340. }
  21341. }
  21342. <?php
  21343. namespace Composer\Repository\Pear;
  21344. class ChannelRest11Reader extends BaseChannelReader
  21345. {
  21346. private $dependencyReader;
  21347. public function __construct($rfs)
  21348. {
  21349. parent::__construct($rfs);
  21350. $this->dependencyReader = new PackageDependencyParser();
  21351. }
  21352. public function read($baseUrl)
  21353. {
  21354. return $this->readChannelPackages($baseUrl);
  21355. }
  21356. private function readChannelPackages($baseUrl)
  21357. {
  21358. $result = array();
  21359. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  21360. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  21361. foreach ($xml->xpath('ns:c') as $node) {
  21362. $categoryName = (string) $node;
  21363. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  21364. $result = array_merge($result, $categoryPackages);
  21365. }
  21366. return $result;
  21367. }
  21368. private function readCategoryPackages($baseUrl, $categoryName)
  21369. {
  21370. $result = array();
  21371. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21372. $xml = $this->requestXml($baseUrl, $categoryPath);
  21373. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21374. foreach ($xml->xpath('ns:pi') as $node) {
  21375. $packageInfo = $this->parsePackage($node);
  21376. $result[] = $packageInfo;
  21377. }
  21378. return $result;
  21379. }
  21380. private function parsePackage($packageInfo)
  21381. {
  21382. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21383. $channelName = (string) $packageInfo->p->c;
  21384. $packageName = (string) $packageInfo->p->n;
  21385. $license = (string) $packageInfo->p->l;
  21386. $shortDescription = (string) $packageInfo->p->s;
  21387. $description = (string) $packageInfo->p->d;
  21388. $dependencies = array();
  21389. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21390. $dependencyVersion = (string) $node->v;
  21391. $dependencyArray = unserialize((string) $node->d);
  21392. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21393. $dependencies[$dependencyVersion] = $dependencyInfo;
  21394. }
  21395. $releases = array();
  21396. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21397. if ($releasesInfo) {
  21398. foreach ($releasesInfo as $node) {
  21399. $releaseVersion = (string) $node->v;
  21400. $releaseStability = (string) $node->s;
  21401. $releases[$releaseVersion] = new ReleaseInfo(
  21402. $releaseStability,
  21403. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21404. );
  21405. }
  21406. }
  21407. return new PackageInfo(
  21408. $channelName,
  21409. $packageName,
  21410. $license,
  21411. $shortDescription,
  21412. $description,
  21413. $releases
  21414. );
  21415. }
  21416. }
  21417. <?php
  21418. namespace Composer\Repository\Pear;
  21419. class DependencyConstraint
  21420. {
  21421. private $type;
  21422. private $constraint;
  21423. private $channelName;
  21424. private $packageName;
  21425. public function __construct($type, $constraint, $channelName, $packageName)
  21426. {
  21427. $this->type = $type;
  21428. $this->constraint = $constraint;
  21429. $this->channelName = $channelName;
  21430. $this->packageName = $packageName;
  21431. }
  21432. public function getChannelName()
  21433. {
  21434. return $this->channelName;
  21435. }
  21436. public function getConstraint()
  21437. {
  21438. return $this->constraint;
  21439. }
  21440. public function getPackageName()
  21441. {
  21442. return $this->packageName;
  21443. }
  21444. public function getType()
  21445. {
  21446. return $this->type;
  21447. }
  21448. }
  21449. <?php
  21450. namespace Composer\Repository\Pear;
  21451. class DependencyInfo
  21452. {
  21453. private $requires;
  21454. private $optionals;
  21455. public function __construct($requires, $optionals)
  21456. {
  21457. $this->requires = $requires;
  21458. $this->optionals = $optionals;
  21459. }
  21460. public function getRequires()
  21461. {
  21462. return $this->requires;
  21463. }
  21464. public function getOptionals()
  21465. {
  21466. return $this->optionals;
  21467. }
  21468. }
  21469. <?php
  21470. namespace Composer\Repository\Pear;
  21471. class PackageDependencyParser
  21472. {
  21473. public function buildDependencyInfo($depArray)
  21474. {
  21475. if (!is_array($depArray)) {
  21476. return new DependencyInfo(array(), array());
  21477. }
  21478. if (!$this->isHash($depArray)) {
  21479. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21480. }
  21481. return $this->buildDependency20Info($depArray);
  21482. }
  21483. private function buildDependency10Info($depArray)
  21484. {
  21485. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21486. $result = array();
  21487. foreach ($depArray as $depItem) {
  21488. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21489. continue;
  21490. }
  21491. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21492. ? 'optional'
  21493. : 'required';
  21494. $depType = 'not' == $depItem['rel']
  21495. ? 'conflicts'
  21496. : $depType;
  21497. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21498. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21499. ? '*'
  21500. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21501. switch ($depItem['type']) {
  21502. case 'php':
  21503. $depChannelName = 'php';
  21504. $depPackageName = '';
  21505. break;
  21506. case 'pkg':
  21507. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21508. $depPackageName = $depItem['name'];
  21509. break;
  21510. case 'ext':
  21511. $depChannelName = 'ext';
  21512. $depPackageName = $depItem['name'];
  21513. break;
  21514. case 'os':
  21515. case 'sapi':
  21516. $depChannelName = '';
  21517. $depPackageName = '';
  21518. break;
  21519. default:
  21520. $depChannelName = '';
  21521. $depPackageName = '';
  21522. break;
  21523. }
  21524. if ('' != $depChannelName) {
  21525. $result[] = new DependencyConstraint(
  21526. $depType,
  21527. $depVersionConstraint,
  21528. $depChannelName,
  21529. $depPackageName
  21530. );
  21531. }
  21532. }
  21533. return $result;
  21534. }
  21535. private function buildDependency20Info($depArray)
  21536. {
  21537. $result = array();
  21538. $optionals = array();
  21539. $defaultOptionals = array();
  21540. foreach ($depArray as $depType => $depTypeGroup) {
  21541. if (!is_array($depTypeGroup)) {
  21542. continue;
  21543. }
  21544. if ('required' == $depType || 'optional' == $depType) {
  21545. foreach ($depTypeGroup as $depItemType => $depItem) {
  21546. switch ($depItemType) {
  21547. case 'php':
  21548. $result[] = new DependencyConstraint(
  21549. $depType,
  21550. $this->parse20VersionConstraint($depItem),
  21551. 'php',
  21552. ''
  21553. );
  21554. break;
  21555. case 'package':
  21556. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21557. $result = array_merge($result, $deps);
  21558. break;
  21559. case 'extension':
  21560. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21561. $result = array_merge($result, $deps);
  21562. break;
  21563. case 'subpackage':
  21564. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21565. $defaultOptionals += $deps;
  21566. break;
  21567. case 'os':
  21568. case 'pearinstaller':
  21569. break;
  21570. default:
  21571. break;
  21572. }
  21573. }
  21574. } elseif ('group' == $depType) {
  21575. if ($this->isHash($depTypeGroup)) {
  21576. $depTypeGroup = array($depTypeGroup);
  21577. }
  21578. foreach ($depTypeGroup as $depItem) {
  21579. $groupName = $depItem['attribs']['name'];
  21580. if (!isset($optionals[$groupName])) {
  21581. $optionals[$groupName] = array();
  21582. }
  21583. if (isset($depItem['subpackage'])) {
  21584. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21585. } else {
  21586. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21587. }
  21588. }
  21589. }
  21590. }
  21591. if (count($defaultOptionals) > 0) {
  21592. $optionals['*'] = $defaultOptionals;
  21593. }
  21594. return new DependencyInfo($result, $optionals);
  21595. }
  21596. private function buildDepExtensionConstraints($depItem, $depType)
  21597. {
  21598. if ($this->isHash($depItem)) {
  21599. $depItem = array($depItem);
  21600. }
  21601. $result = array();
  21602. foreach ($depItem as $subDepItem) {
  21603. $depChannelName = 'ext';
  21604. $depPackageName = $subDepItem['name'];
  21605. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21606. $result[] = new DependencyConstraint(
  21607. $depType,
  21608. $depVersionConstraint,
  21609. $depChannelName,
  21610. $depPackageName
  21611. );
  21612. }
  21613. return $result;
  21614. }
  21615. private function buildDepPackageConstraints($depItem, $depType)
  21616. {
  21617. if ($this->isHash($depItem)) {
  21618. $depItem = array($depItem);
  21619. }
  21620. $result = array();
  21621. foreach ($depItem as $subDepItem) {
  21622. if (!array_key_exists('channel', $subDepItem)) {
  21623. $subDepItem['channel'] = $subDepItem['uri'];
  21624. }
  21625. $depChannelName = $subDepItem['channel'];
  21626. $depPackageName = $subDepItem['name'];
  21627. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21628. if (isset($subDepItem['conflicts'])) {
  21629. $depType = 'conflicts';
  21630. }
  21631. $result[] = new DependencyConstraint(
  21632. $depType,
  21633. $depVersionConstraint,
  21634. $depChannelName,
  21635. $depPackageName
  21636. );
  21637. }
  21638. return $result;
  21639. }
  21640. private function parse20VersionConstraint(array $data)
  21641. {
  21642. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21643. $versions = array();
  21644. $values = array_intersect_key($data, $dep20toOperatorMap);
  21645. if (0 == count($values)) {
  21646. return '*';
  21647. }
  21648. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21649. $versions[] = '>' . $this->parseVersion($values['min']);
  21650. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21651. $versions[] = '<' . $this->parseVersion($values['max']);
  21652. } else {
  21653. foreach ($values as $op => $version) {
  21654. if ('exclude' == $op && is_array($version)) {
  21655. foreach ($version as $versionPart) {
  21656. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21657. }
  21658. } else {
  21659. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21660. }
  21661. }
  21662. }
  21663. return implode(',', $versions);
  21664. }
  21665. private function parseVersion($version)
  21666. {
  21667. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21668. $version = $matches[1]
  21669. .(!empty($matches[2]) ? $matches[2] : '.0')
  21670. .(!empty($matches[3]) ? $matches[3] : '.0')
  21671. .(!empty($matches[4]) ? $matches[4] : '.0');
  21672. return $version;
  21673. }
  21674. return null;
  21675. }
  21676. private function isHash(array $array)
  21677. {
  21678. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21679. }
  21680. }
  21681. <?php
  21682. namespace Composer\Repository\Pear;
  21683. class PackageInfo
  21684. {
  21685. private $channelName;
  21686. private $packageName;
  21687. private $license;
  21688. private $shortDescription;
  21689. private $description;
  21690. private $releases;
  21691. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21692. {
  21693. $this->channelName = $channelName;
  21694. $this->packageName = $packageName;
  21695. $this->license = $license;
  21696. $this->shortDescription = $shortDescription;
  21697. $this->description = $description;
  21698. $this->releases = $releases;
  21699. }
  21700. public function getChannelName()
  21701. {
  21702. return $this->channelName;
  21703. }
  21704. public function getPackageName()
  21705. {
  21706. return $this->packageName;
  21707. }
  21708. public function getDescription()
  21709. {
  21710. return $this->description;
  21711. }
  21712. public function getShortDescription()
  21713. {
  21714. return $this->shortDescription;
  21715. }
  21716. public function getLicense()
  21717. {
  21718. return $this->license;
  21719. }
  21720. public function getReleases()
  21721. {
  21722. return $this->releases;
  21723. }
  21724. }
  21725. <?php
  21726. namespace Composer\Repository\Pear;
  21727. class ReleaseInfo
  21728. {
  21729. private $stability;
  21730. private $dependencyInfo;
  21731. public function __construct($stability, $dependencyInfo)
  21732. {
  21733. $this->stability = $stability;
  21734. $this->dependencyInfo = $dependencyInfo;
  21735. }
  21736. public function getDependencyInfo()
  21737. {
  21738. return $this->dependencyInfo;
  21739. }
  21740. public function getStability()
  21741. {
  21742. return $this->stability;
  21743. }
  21744. }
  21745. <?php
  21746. namespace Composer\Repository;
  21747. use Composer\IO\IOInterface;
  21748. use Composer\Semver\VersionParser as SemverVersionParser;
  21749. use Composer\Package\Version\VersionParser;
  21750. use Composer\Repository\Pear\ChannelReader;
  21751. use Composer\Package\CompletePackage;
  21752. use Composer\Repository\Pear\ChannelInfo;
  21753. use Composer\EventDispatcher\EventDispatcher;
  21754. use Composer\Package\Link;
  21755. use Composer\Semver\Constraint\Constraint;
  21756. use Composer\Util\RemoteFilesystem;
  21757. use Composer\Config;
  21758. use Composer\Factory;
  21759. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21760. {
  21761. private $url;
  21762. private $io;
  21763. private $rfs;
  21764. private $versionParser;
  21765. private $repoConfig;
  21766. private $vendorAlias;
  21767. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21768. {
  21769. parent::__construct();
  21770. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21771. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21772. }
  21773. $urlBits = parse_url($repoConfig['url']);
  21774. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21775. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21776. }
  21777. $this->url = rtrim($repoConfig['url'], '/');
  21778. $this->io = $io;
  21779. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21780. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21781. $this->versionParser = new VersionParser();
  21782. $this->repoConfig = $repoConfig;
  21783. }
  21784. public function getRepoConfig()
  21785. {
  21786. return $this->repoConfig;
  21787. }
  21788. protected function initialize()
  21789. {
  21790. parent::initialize();
  21791. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21792. $reader = new ChannelReader($this->rfs);
  21793. try {
  21794. $channelInfo = $reader->read($this->url);
  21795. } catch (\Exception $e) {
  21796. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21797. return;
  21798. }
  21799. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21800. foreach ($packages as $package) {
  21801. $this->addPackage($package);
  21802. }
  21803. }
  21804. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21805. {
  21806. $result = array();
  21807. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21808. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21809. try {
  21810. $normalizedVersion = $versionParser->normalize($version);
  21811. } catch (\UnexpectedValueException $e) {
  21812. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21813. continue;
  21814. }
  21815. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21816. $urlBits = parse_url($this->url);
  21817. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21818. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21819. $requires = array();
  21820. $suggests = array();
  21821. $conflicts = array();
  21822. $replaces = array();
  21823. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21824. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21825. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21826. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21827. }
  21828. if (!empty($this->vendorAlias)
  21829. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21830. ) {
  21831. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21832. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21833. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21834. }
  21835. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21836. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21837. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21838. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21839. switch ($dependencyConstraint->getType()) {
  21840. case 'required':
  21841. $requires[] = $link;
  21842. break;
  21843. case 'conflicts':
  21844. $conflicts[] = $link;
  21845. break;
  21846. case 'replaces':
  21847. $replaces[] = $link;
  21848. break;
  21849. }
  21850. }
  21851. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21852. foreach ($dependencyConstraints as $dependencyConstraint) {
  21853. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21854. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21855. }
  21856. }
  21857. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21858. $package->setType('pear-library');
  21859. $package->setDescription($packageDefinition->getDescription());
  21860. $package->setLicense(array($packageDefinition->getLicense()));
  21861. $package->setDistType('file');
  21862. $package->setDistUrl($distUrl);
  21863. $package->setAutoload(array('classmap' => array('')));
  21864. $package->setIncludePaths(array('/'));
  21865. $package->setRequires($requires);
  21866. $package->setConflicts($conflicts);
  21867. $package->setSuggests($suggests);
  21868. $package->setReplaces($replaces);
  21869. $result[] = $package;
  21870. }
  21871. }
  21872. return $result;
  21873. }
  21874. private function buildComposerPackageName($channelName, $packageName)
  21875. {
  21876. if ('php' === $channelName) {
  21877. return "php";
  21878. }
  21879. if ('ext' === $channelName) {
  21880. return "ext-{$packageName}";
  21881. }
  21882. return "pear-{$channelName}/{$packageName}";
  21883. }
  21884. }
  21885. <?php
  21886. namespace Composer\Repository;
  21887. use Composer\Package\CompletePackage;
  21888. use Composer\Package\PackageInterface;
  21889. use Composer\Package\Version\VersionParser;
  21890. use Composer\Plugin\PluginInterface;
  21891. use Composer\Util\ProcessExecutor;
  21892. use Composer\Util\Silencer;
  21893. use Composer\Util\Platform;
  21894. use Composer\XdebugHandler\XdebugHandler;
  21895. use Symfony\Component\Process\ExecutableFinder;
  21896. class PlatformRepository extends ArrayRepository
  21897. {
  21898. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-plugin-api)$}iD';
  21899. private $versionParser;
  21900. private $overrides = array();
  21901. private $process;
  21902. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  21903. {
  21904. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  21905. foreach ($overrides as $name => $version) {
  21906. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21907. }
  21908. parent::__construct($packages);
  21909. }
  21910. protected function initialize()
  21911. {
  21912. parent::initialize();
  21913. $this->versionParser = new VersionParser();
  21914. foreach ($this->overrides as $override) {
  21915. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21916. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21917. }
  21918. $this->addOverriddenPackage($override);
  21919. }
  21920. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21921. $version = $this->versionParser->normalize($prettyVersion);
  21922. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21923. $composerPluginApi->setDescription('The Composer Plugin API');
  21924. $this->addPackage($composerPluginApi);
  21925. try {
  21926. $prettyVersion = PHP_VERSION;
  21927. $version = $this->versionParser->normalize($prettyVersion);
  21928. } catch (\UnexpectedValueException $e) {
  21929. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21930. $version = $this->versionParser->normalize($prettyVersion);
  21931. }
  21932. $php = new CompletePackage('php', $version, $prettyVersion);
  21933. $php->setDescription('The PHP interpreter');
  21934. $this->addPackage($php);
  21935. if (PHP_DEBUG) {
  21936. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21937. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21938. $this->addPackage($phpdebug);
  21939. }
  21940. if (defined('PHP_ZTS') && PHP_ZTS) {
  21941. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21942. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21943. $this->addPackage($phpzts);
  21944. }
  21945. if (PHP_INT_SIZE === 8) {
  21946. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21947. $php64->setDescription('The PHP interpreter, 64bit');
  21948. $this->addPackage($php64);
  21949. }
  21950. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21951. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21952. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21953. $this->addPackage($phpIpv6);
  21954. }
  21955. $loadedExtensions = get_loaded_extensions();
  21956. foreach ($loadedExtensions as $name) {
  21957. if (in_array($name, array('standard', 'Core'))) {
  21958. continue;
  21959. }
  21960. $reflExt = new \ReflectionExtension($name);
  21961. $prettyVersion = $reflExt->getVersion();
  21962. $this->addExtension($name, $prettyVersion);
  21963. }
  21964. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  21965. $this->addExtension('xdebug', $prettyVersion);
  21966. }
  21967. foreach ($loadedExtensions as $name) {
  21968. $prettyVersion = null;
  21969. $description = 'The '.$name.' PHP library';
  21970. switch ($name) {
  21971. case 'curl':
  21972. $curlVersion = curl_version();
  21973. $prettyVersion = $curlVersion['version'];
  21974. break;
  21975. case 'iconv':
  21976. $prettyVersion = ICONV_VERSION;
  21977. break;
  21978. case 'intl':
  21979. $name = 'ICU';
  21980. if (defined('INTL_ICU_VERSION')) {
  21981. $prettyVersion = INTL_ICU_VERSION;
  21982. } else {
  21983. $reflector = new \ReflectionExtension('intl');
  21984. ob_start();
  21985. $reflector->info();
  21986. $output = ob_get_clean();
  21987. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21988. $prettyVersion = $matches[1];
  21989. }
  21990. break;
  21991. case 'imagick':
  21992. $imagick = new \Imagick();
  21993. $imageMagickVersion = $imagick->getVersion();
  21994. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  21995. if (isset($matches[2])) {
  21996. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  21997. } else {
  21998. $prettyVersion = $matches[1];
  21999. }
  22000. break;
  22001. case 'libxml':
  22002. $prettyVersion = LIBXML_DOTTED_VERSION;
  22003. break;
  22004. case 'openssl':
  22005. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22006. if (empty($match[2])) {
  22007. return $match[1];
  22008. }
  22009. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22010. return 0;
  22011. }
  22012. $len = strlen($match[2]);
  22013. $patchVersion = ($len - 1) * 26;
  22014. $patchVersion += ord($match[2][$len - 1]) - 96;
  22015. return $match[1].'.'.$patchVersion;
  22016. }, OPENSSL_VERSION_TEXT);
  22017. $description = OPENSSL_VERSION_TEXT;
  22018. break;
  22019. case 'pcre':
  22020. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22021. break;
  22022. case 'uuid':
  22023. $prettyVersion = phpversion('uuid');
  22024. break;
  22025. case 'xsl':
  22026. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22027. break;
  22028. default:
  22029. continue 2;
  22030. }
  22031. try {
  22032. $version = $this->versionParser->normalize($prettyVersion);
  22033. } catch (\UnexpectedValueException $e) {
  22034. continue;
  22035. }
  22036. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22037. $lib->setDescription($description);
  22038. $this->addPackage($lib);
  22039. }
  22040. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22041. if ($hhvmVersion === null && !Platform::isWindows()) {
  22042. $finder = new ExecutableFinder();
  22043. $hhvm = $finder->find('hhvm');
  22044. if ($hhvm !== null) {
  22045. $exitCode = $this->process->execute(
  22046. ProcessExecutor::escape($hhvm).
  22047. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22048. $hhvmVersion
  22049. );
  22050. if ($exitCode !== 0) {
  22051. $hhvmVersion = null;
  22052. }
  22053. }
  22054. }
  22055. if ($hhvmVersion) {
  22056. try {
  22057. $prettyVersion = $hhvmVersion;
  22058. $version = $this->versionParser->normalize($prettyVersion);
  22059. } catch (\UnexpectedValueException $e) {
  22060. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22061. $version = $this->versionParser->normalize($prettyVersion);
  22062. }
  22063. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22064. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22065. $this->addPackage($hhvm);
  22066. }
  22067. }
  22068. public function addPackage(PackageInterface $package)
  22069. {
  22070. if (isset($this->overrides[$package->getName()])) {
  22071. $overrider = $this->findPackage($package->getName(), '*');
  22072. if ($package->getVersion() === $overrider->getVersion()) {
  22073. $actualText = 'same as actual';
  22074. } else {
  22075. $actualText = 'actual: '.$package->getPrettyVersion();
  22076. }
  22077. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22078. return;
  22079. }
  22080. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22081. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22082. if ($package->getVersion() === $overrider->getVersion()) {
  22083. $actualText = 'same as actual';
  22084. } else {
  22085. $actualText = 'actual: '.$package->getPrettyVersion();
  22086. }
  22087. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22088. return;
  22089. }
  22090. parent::addPackage($package);
  22091. }
  22092. private function addOverriddenPackage(array $override, $name = null)
  22093. {
  22094. $version = $this->versionParser->normalize($override['version']);
  22095. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22096. $package->setDescription('Package overridden via config.platform');
  22097. $package->setExtra(array('config.platform' => true));
  22098. parent::addPackage($package);
  22099. return $package;
  22100. }
  22101. private function addExtension($name, $prettyVersion)
  22102. {
  22103. $extraDescription = null;
  22104. try {
  22105. $version = $this->versionParser->normalize($prettyVersion);
  22106. } catch (\UnexpectedValueException $e) {
  22107. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22108. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22109. $prettyVersion = $match[1];
  22110. } else {
  22111. $prettyVersion = '0';
  22112. }
  22113. $version = $this->versionParser->normalize($prettyVersion);
  22114. }
  22115. $packageName = $this->buildPackageName($name);
  22116. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22117. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22118. $this->addPackage($ext);
  22119. }
  22120. private function buildPackageName($name)
  22121. {
  22122. return 'ext-' . str_replace(' ', '-', $name);
  22123. }
  22124. }
  22125. <?php
  22126. namespace Composer\Repository;
  22127. use Composer\Factory;
  22128. use Composer\IO\IOInterface;
  22129. use Composer\Config;
  22130. use Composer\EventDispatcher\EventDispatcher;
  22131. use Composer\Util\RemoteFilesystem;
  22132. use Composer\Json\JsonFile;
  22133. class RepositoryFactory
  22134. {
  22135. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22136. {
  22137. if (0 === strpos($repository, 'http')) {
  22138. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22139. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22140. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22141. $data = $json->read();
  22142. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22143. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22144. } elseif ($allowFilesystem) {
  22145. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22146. } else {
  22147. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  22148. }
  22149. } elseif ('{' === substr($repository, 0, 1)) {
  22150. $repoConfig = JsonFile::parseJson($repository);
  22151. } else {
  22152. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  22153. }
  22154. return $repoConfig;
  22155. }
  22156. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22157. {
  22158. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  22159. return static::createRepo($io, $config, $repoConfig);
  22160. }
  22161. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  22162. {
  22163. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22164. $repos = static::createRepos($rm, array($repoConfig));
  22165. return reset($repos);
  22166. }
  22167. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  22168. {
  22169. if (!$config) {
  22170. $config = Factory::createConfig($io);
  22171. }
  22172. if ($io) {
  22173. $io->loadConfiguration($config);
  22174. }
  22175. if (!$rm) {
  22176. if (!$io) {
  22177. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  22178. }
  22179. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22180. }
  22181. return static::createRepos($rm, $config->getRepositories());
  22182. }
  22183. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22184. {
  22185. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  22186. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  22187. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  22188. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  22189. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  22190. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  22191. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  22192. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  22193. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  22194. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  22195. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  22196. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  22197. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  22198. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  22199. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  22200. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  22201. return $rm;
  22202. }
  22203. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  22204. {
  22205. $repos = array();
  22206. foreach ($repoConfigs as $index => $repo) {
  22207. if (is_string($repo)) {
  22208. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  22209. }
  22210. if (!is_array($repo)) {
  22211. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  22212. }
  22213. if (!isset($repo['type'])) {
  22214. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  22215. }
  22216. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  22217. while (isset($repos[$name])) {
  22218. $name .= '2';
  22219. }
  22220. if ($repo['type'] === 'filesystem') {
  22221. $repos[$name] = new FilesystemRepository($repo['json']);
  22222. } else {
  22223. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  22224. }
  22225. }
  22226. return $repos;
  22227. }
  22228. }
  22229. <?php
  22230. namespace Composer\Repository;
  22231. use Composer\Package\PackageInterface;
  22232. interface RepositoryInterface extends \Countable
  22233. {
  22234. const SEARCH_FULLTEXT = 0;
  22235. const SEARCH_NAME = 1;
  22236. public function hasPackage(PackageInterface $package);
  22237. public function findPackage($name, $constraint);
  22238. public function findPackages($name, $constraint = null);
  22239. public function getPackages();
  22240. public function search($query, $mode = 0);
  22241. }
  22242. <?php
  22243. namespace Composer\Repository;
  22244. use Composer\IO\IOInterface;
  22245. use Composer\Config;
  22246. use Composer\EventDispatcher\EventDispatcher;
  22247. use Composer\Package\PackageInterface;
  22248. use Composer\Util\RemoteFilesystem;
  22249. class RepositoryManager
  22250. {
  22251. private $localRepository;
  22252. private $repositories = array();
  22253. private $repositoryClasses = array();
  22254. private $io;
  22255. private $config;
  22256. private $eventDispatcher;
  22257. private $rfs;
  22258. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22259. {
  22260. $this->io = $io;
  22261. $this->config = $config;
  22262. $this->eventDispatcher = $eventDispatcher;
  22263. $this->rfs = $rfs;
  22264. }
  22265. public function findPackage($name, $constraint)
  22266. {
  22267. foreach ($this->repositories as $repository) {
  22268. if ($package = $repository->findPackage($name, $constraint)) {
  22269. return $package;
  22270. }
  22271. }
  22272. return null;
  22273. }
  22274. public function findPackages($name, $constraint)
  22275. {
  22276. $packages = array();
  22277. foreach ($this->getRepositories() as $repository) {
  22278. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  22279. }
  22280. return $packages;
  22281. }
  22282. public function addRepository(RepositoryInterface $repository)
  22283. {
  22284. $this->repositories[] = $repository;
  22285. }
  22286. public function prependRepository(RepositoryInterface $repository)
  22287. {
  22288. array_unshift($this->repositories, $repository);
  22289. }
  22290. public function createRepository($type, $config, $name = null)
  22291. {
  22292. if (!isset($this->repositoryClasses[$type])) {
  22293. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  22294. }
  22295. if (isset($config['packagist']) && false === $config['packagist']) {
  22296. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  22297. }
  22298. $class = $this->repositoryClasses[$type];
  22299. $reflMethod = new \ReflectionMethod($class, '__construct');
  22300. $params = $reflMethod->getParameters();
  22301. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  22302. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  22303. }
  22304. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  22305. }
  22306. public function setRepositoryClass($type, $class)
  22307. {
  22308. $this->repositoryClasses[$type] = $class;
  22309. }
  22310. public function getRepositories()
  22311. {
  22312. return $this->repositories;
  22313. }
  22314. public function setLocalRepository(WritableRepositoryInterface $repository)
  22315. {
  22316. $this->localRepository = $repository;
  22317. }
  22318. public function getLocalRepository()
  22319. {
  22320. return $this->localRepository;
  22321. }
  22322. }
  22323. <?php
  22324. namespace Composer\Repository;
  22325. class RepositorySecurityException extends \Exception
  22326. {
  22327. }
  22328. <?php
  22329. namespace Composer\Repository\Vcs;
  22330. use Composer\Cache;
  22331. use Composer\Downloader\TransportException;
  22332. use Composer\Json\JsonFile;
  22333. use Composer\Util\Bitbucket;
  22334. abstract class BitbucketDriver extends VcsDriver
  22335. {
  22336. protected $cache;
  22337. protected $owner;
  22338. protected $repository;
  22339. protected $hasIssues;
  22340. protected $rootIdentifier;
  22341. protected $tags;
  22342. protected $branches;
  22343. protected $infoCache = array();
  22344. protected $branchesUrl = '';
  22345. protected $tagsUrl = '';
  22346. protected $homeUrl = '';
  22347. protected $website = '';
  22348. protected $cloneHttpsUrl = '';
  22349. protected $fallbackDriver;
  22350. protected $vcsType;
  22351. public function initialize()
  22352. {
  22353. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  22354. $this->owner = $match[1];
  22355. $this->repository = $match[2];
  22356. $this->originUrl = 'bitbucket.org';
  22357. $this->cache = new Cache(
  22358. $this->io,
  22359. implode('/', array(
  22360. $this->config->get('cache-repo-dir'),
  22361. $this->originUrl,
  22362. $this->owner,
  22363. $this->repository,
  22364. ))
  22365. );
  22366. }
  22367. public function getUrl()
  22368. {
  22369. if ($this->fallbackDriver) {
  22370. return $this->fallbackDriver->getUrl();
  22371. }
  22372. return $this->cloneHttpsUrl;
  22373. }
  22374. protected function getRepoData()
  22375. {
  22376. $resource = sprintf(
  22377. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  22378. $this->owner,
  22379. $this->repository,
  22380. http_build_query(
  22381. array('fields' => '-project,-owner'),
  22382. null,
  22383. '&'
  22384. )
  22385. );
  22386. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  22387. if ($this->fallbackDriver) {
  22388. return false;
  22389. }
  22390. $this->parseCloneUrls($repoData['links']['clone']);
  22391. $this->hasIssues = !empty($repoData['has_issues']);
  22392. $this->branchesUrl = $repoData['links']['branches']['href'];
  22393. $this->tagsUrl = $repoData['links']['tags']['href'];
  22394. $this->homeUrl = $repoData['links']['html']['href'];
  22395. $this->website = $repoData['website'];
  22396. $this->vcsType = $repoData['scm'];
  22397. return true;
  22398. }
  22399. public function getComposerInformation($identifier)
  22400. {
  22401. if ($this->fallbackDriver) {
  22402. return $this->fallbackDriver->getComposerInformation($identifier);
  22403. }
  22404. if (!isset($this->infoCache[$identifier])) {
  22405. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22406. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22407. }
  22408. $composer = $this->getBaseComposerInformation($identifier);
  22409. if ($composer) {
  22410. if (!isset($composer['support']['source'])) {
  22411. $label = array_search(
  22412. $identifier,
  22413. $this->getTags()
  22414. ) ?: array_search(
  22415. $identifier,
  22416. $this->getBranches()
  22417. ) ?: $identifier;
  22418. if (array_key_exists($label, $tags = $this->getTags())) {
  22419. $hash = $tags[$label];
  22420. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22421. $hash = $branches[$label];
  22422. }
  22423. if (! isset($hash)) {
  22424. $composer['support']['source'] = sprintf(
  22425. 'https://%s/%s/%s/src',
  22426. $this->originUrl,
  22427. $this->owner,
  22428. $this->repository
  22429. );
  22430. } else {
  22431. $composer['support']['source'] = sprintf(
  22432. 'https://%s/%s/%s/src/%s/?at=%s',
  22433. $this->originUrl,
  22434. $this->owner,
  22435. $this->repository,
  22436. $hash,
  22437. $label
  22438. );
  22439. }
  22440. }
  22441. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22442. $composer['support']['issues'] = sprintf(
  22443. 'https://%s/%s/%s/issues',
  22444. $this->originUrl,
  22445. $this->owner,
  22446. $this->repository
  22447. );
  22448. }
  22449. if (!isset($composer['homepage'])) {
  22450. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22451. }
  22452. }
  22453. $this->infoCache[$identifier] = $composer;
  22454. if ($this->shouldCache($identifier)) {
  22455. $this->cache->write($identifier, json_encode($composer));
  22456. }
  22457. }
  22458. return $this->infoCache[$identifier];
  22459. }
  22460. public function getFileContent($file, $identifier)
  22461. {
  22462. if ($this->fallbackDriver) {
  22463. return $this->fallbackDriver->getFileContent($file, $identifier);
  22464. }
  22465. if (strpos($identifier, '/') !== false) {
  22466. $branches = $this->getBranches();
  22467. if (isset($branches[$identifier])) {
  22468. $identifier = $branches[$identifier];
  22469. }
  22470. }
  22471. $resource = sprintf(
  22472. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22473. $this->owner,
  22474. $this->repository,
  22475. $identifier,
  22476. $file
  22477. );
  22478. return $this->getContentsWithOAuthCredentials($resource);
  22479. }
  22480. public function getChangeDate($identifier)
  22481. {
  22482. if ($this->fallbackDriver) {
  22483. return $this->fallbackDriver->getChangeDate($identifier);
  22484. }
  22485. if (strpos($identifier, '/') !== false) {
  22486. $branches = $this->getBranches();
  22487. if (isset($branches[$identifier])) {
  22488. $identifier = $branches[$identifier];
  22489. }
  22490. }
  22491. $resource = sprintf(
  22492. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22493. $this->owner,
  22494. $this->repository,
  22495. $identifier
  22496. );
  22497. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22498. return new \DateTime($commit['date']);
  22499. }
  22500. public function getSource($identifier)
  22501. {
  22502. if ($this->fallbackDriver) {
  22503. return $this->fallbackDriver->getSource($identifier);
  22504. }
  22505. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22506. }
  22507. public function getDist($identifier)
  22508. {
  22509. if ($this->fallbackDriver) {
  22510. return $this->fallbackDriver->getDist($identifier);
  22511. }
  22512. $url = sprintf(
  22513. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22514. $this->owner,
  22515. $this->repository,
  22516. $identifier
  22517. );
  22518. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22519. }
  22520. public function getTags()
  22521. {
  22522. if ($this->fallbackDriver) {
  22523. return $this->fallbackDriver->getTags();
  22524. }
  22525. if (null === $this->tags) {
  22526. $this->tags = array();
  22527. $resource = sprintf(
  22528. '%s?%s',
  22529. $this->tagsUrl,
  22530. http_build_query(
  22531. array(
  22532. 'pagelen' => 100,
  22533. 'fields' => 'values.name,values.target.hash,next',
  22534. 'sort' => '-target.date',
  22535. ),
  22536. null,
  22537. '&'
  22538. )
  22539. );
  22540. $hasNext = true;
  22541. while ($hasNext) {
  22542. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22543. foreach ($tagsData['values'] as $data) {
  22544. $this->tags[$data['name']] = $data['target']['hash'];
  22545. }
  22546. if (empty($tagsData['next'])) {
  22547. $hasNext = false;
  22548. } else {
  22549. $resource = $tagsData['next'];
  22550. }
  22551. }
  22552. if ($this->vcsType === 'hg') {
  22553. unset($this->tags['tip']);
  22554. }
  22555. }
  22556. return $this->tags;
  22557. }
  22558. public function getBranches()
  22559. {
  22560. if ($this->fallbackDriver) {
  22561. return $this->fallbackDriver->getBranches();
  22562. }
  22563. if (null === $this->branches) {
  22564. $this->branches = array();
  22565. $resource = sprintf(
  22566. '%s?%s',
  22567. $this->branchesUrl,
  22568. http_build_query(
  22569. array(
  22570. 'pagelen' => 100,
  22571. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22572. 'sort' => '-target.date',
  22573. ),
  22574. null,
  22575. '&'
  22576. )
  22577. );
  22578. $hasNext = true;
  22579. while ($hasNext) {
  22580. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22581. foreach ($branchData['values'] as $data) {
  22582. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22583. continue;
  22584. }
  22585. $this->branches[$data['name']] = $data['target']['hash'];
  22586. }
  22587. if (empty($branchData['next'])) {
  22588. $hasNext = false;
  22589. } else {
  22590. $resource = $branchData['next'];
  22591. }
  22592. }
  22593. }
  22594. return $this->branches;
  22595. }
  22596. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22597. {
  22598. try {
  22599. return parent::getContents($url);
  22600. } catch (TransportException $e) {
  22601. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22602. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22603. if (!$this->io->hasAuthentication($this->originUrl)
  22604. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22605. ) {
  22606. return parent::getContents($url);
  22607. }
  22608. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22609. return $this->attemptCloneFallback();
  22610. }
  22611. }
  22612. throw $e;
  22613. }
  22614. }
  22615. abstract protected function generateSshUrl();
  22616. protected function attemptCloneFallback()
  22617. {
  22618. try {
  22619. $this->setupFallbackDriver($this->generateSshUrl());
  22620. } catch (\RuntimeException $e) {
  22621. $this->fallbackDriver = null;
  22622. $this->io->writeError(
  22623. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22624. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22625. );
  22626. throw $e;
  22627. }
  22628. }
  22629. abstract protected function setupFallbackDriver($url);
  22630. protected function parseCloneUrls(array $cloneLinks)
  22631. {
  22632. foreach ($cloneLinks as $cloneLink) {
  22633. if ($cloneLink['name'] === 'https') {
  22634. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22635. }
  22636. }
  22637. }
  22638. protected function getMainBranchData()
  22639. {
  22640. $resource = sprintf(
  22641. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22642. $this->owner,
  22643. $this->repository
  22644. );
  22645. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22646. if (isset($data['mainbranch'])) {
  22647. return $data['mainbranch'];
  22648. }
  22649. return null;
  22650. }
  22651. }
  22652. <?php
  22653. namespace Composer\Repository\Vcs;
  22654. use Composer\Cache;
  22655. use Composer\Config;
  22656. use Composer\Util\ProcessExecutor;
  22657. use Composer\Util\Filesystem;
  22658. use Composer\IO\IOInterface;
  22659. class FossilDriver extends VcsDriver
  22660. {
  22661. protected $tags;
  22662. protected $branches;
  22663. protected $rootIdentifier;
  22664. protected $repoFile;
  22665. protected $checkoutDir;
  22666. protected $infoCache = array();
  22667. public function initialize()
  22668. {
  22669. $this->checkFossil();
  22670. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22671. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22672. $this->checkoutDir = $this->url;
  22673. } else {
  22674. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  22675. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  22676. }
  22677. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22678. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22679. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22680. $this->updateLocalRepo();
  22681. }
  22682. $this->getTags();
  22683. $this->getBranches();
  22684. }
  22685. protected function checkFossil()
  22686. {
  22687. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22688. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22689. }
  22690. }
  22691. protected function updateLocalRepo()
  22692. {
  22693. $fs = new Filesystem();
  22694. $fs->ensureDirectoryExists($this->checkoutDir);
  22695. if (!is_writable(dirname($this->checkoutDir))) {
  22696. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22697. }
  22698. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22699. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22700. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22701. }
  22702. } else {
  22703. $fs->removeDirectory($this->checkoutDir);
  22704. $fs->remove($this->repoFile);
  22705. $fs->ensureDirectoryExists($this->checkoutDir);
  22706. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22707. $output = $this->process->getErrorOutput();
  22708. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22709. }
  22710. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22711. $output = $this->process->getErrorOutput();
  22712. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22713. }
  22714. }
  22715. }
  22716. public function getRootIdentifier()
  22717. {
  22718. if (null === $this->rootIdentifier) {
  22719. $this->rootIdentifier = 'trunk';
  22720. }
  22721. return $this->rootIdentifier;
  22722. }
  22723. public function getUrl()
  22724. {
  22725. return $this->url;
  22726. }
  22727. public function getSource($identifier)
  22728. {
  22729. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22730. }
  22731. public function getDist($identifier)
  22732. {
  22733. return null;
  22734. }
  22735. public function getFileContent($file, $identifier)
  22736. {
  22737. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22738. $this->process->execute($command, $content, $this->checkoutDir);
  22739. if (!trim($content)) {
  22740. return null;
  22741. }
  22742. return $content;
  22743. }
  22744. public function getChangeDate($identifier)
  22745. {
  22746. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22747. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22748. return new \DateTime($date, new \DateTimeZone('UTC'));
  22749. }
  22750. public function getTags()
  22751. {
  22752. if (null === $this->tags) {
  22753. $tags = array();
  22754. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22755. foreach ($this->process->splitLines($output) as $tag) {
  22756. $tags[$tag] = $tag;
  22757. }
  22758. $this->tags = $tags;
  22759. }
  22760. return $this->tags;
  22761. }
  22762. public function getBranches()
  22763. {
  22764. if (null === $this->branches) {
  22765. $branches = array();
  22766. $bookmarks = array();
  22767. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22768. foreach ($this->process->splitLines($output) as $branch) {
  22769. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22770. $branches[$branch] = $branch;
  22771. }
  22772. $this->branches = $branches;
  22773. }
  22774. return $this->branches;
  22775. }
  22776. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22777. {
  22778. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22779. return true;
  22780. }
  22781. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22782. return true;
  22783. }
  22784. if (Filesystem::isLocalPath($url)) {
  22785. $url = Filesystem::getPlatformPath($url);
  22786. if (!is_dir($url)) {
  22787. return false;
  22788. }
  22789. $process = new ProcessExecutor($io);
  22790. if ($process->execute('fossil info', $output, $url) === 0) {
  22791. return true;
  22792. }
  22793. }
  22794. return false;
  22795. }
  22796. }
  22797. <?php
  22798. namespace Composer\Repository\Vcs;
  22799. use Composer\Config;
  22800. use Composer\IO\IOInterface;
  22801. class GitBitbucketDriver extends BitbucketDriver
  22802. {
  22803. public function getRootIdentifier()
  22804. {
  22805. if ($this->fallbackDriver) {
  22806. return $this->fallbackDriver->getRootIdentifier();
  22807. }
  22808. if (null === $this->rootIdentifier) {
  22809. if (! $this->getRepoData()) {
  22810. return $this->fallbackDriver->getRootIdentifier();
  22811. }
  22812. if ($this->vcsType !== 'git') {
  22813. throw new \RuntimeException(
  22814. $this->url.' does not appear to be a git repository, use '.
  22815. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22816. );
  22817. }
  22818. $mainBranchData = $this->getMainBranchData();
  22819. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22820. }
  22821. return $this->rootIdentifier;
  22822. }
  22823. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22824. {
  22825. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  22826. return false;
  22827. }
  22828. if (!extension_loaded('openssl')) {
  22829. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22830. return false;
  22831. }
  22832. return true;
  22833. }
  22834. protected function setupFallbackDriver($url)
  22835. {
  22836. $this->fallbackDriver = new GitDriver(
  22837. array('url' => $url),
  22838. $this->io,
  22839. $this->config,
  22840. $this->process,
  22841. $this->remoteFilesystem
  22842. );
  22843. $this->fallbackDriver->initialize();
  22844. }
  22845. protected function generateSshUrl()
  22846. {
  22847. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22848. }
  22849. }
  22850. <?php
  22851. namespace Composer\Repository\Vcs;
  22852. use Composer\Util\ProcessExecutor;
  22853. use Composer\Util\Filesystem;
  22854. use Composer\Util\Git as GitUtil;
  22855. use Composer\IO\IOInterface;
  22856. use Composer\Cache;
  22857. use Composer\Config;
  22858. class GitDriver extends VcsDriver
  22859. {
  22860. protected $cache;
  22861. protected $tags;
  22862. protected $branches;
  22863. protected $rootIdentifier;
  22864. protected $repoDir;
  22865. protected $infoCache = array();
  22866. public function initialize()
  22867. {
  22868. if (Filesystem::isLocalPath($this->url)) {
  22869. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22870. $this->repoDir = $this->url;
  22871. $cacheUrl = realpath($this->url);
  22872. } else {
  22873. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  22874. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  22875. }
  22876. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22877. GitUtil::cleanEnv();
  22878. $fs = new Filesystem();
  22879. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22880. if (!is_writable(dirname($this->repoDir))) {
  22881. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22882. }
  22883. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22884. 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.');
  22885. }
  22886. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22887. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22888. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22889. }
  22890. $cacheUrl = $this->url;
  22891. }
  22892. $this->getTags();
  22893. $this->getBranches();
  22894. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22895. }
  22896. public function getRootIdentifier()
  22897. {
  22898. if (null === $this->rootIdentifier) {
  22899. $this->rootIdentifier = 'master';
  22900. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22901. $branches = $this->process->splitLines($output);
  22902. if (!in_array('* master', $branches)) {
  22903. foreach ($branches as $branch) {
  22904. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22905. $this->rootIdentifier = $match[1];
  22906. break;
  22907. }
  22908. }
  22909. }
  22910. }
  22911. return $this->rootIdentifier;
  22912. }
  22913. public function getUrl()
  22914. {
  22915. return $this->url;
  22916. }
  22917. public function getSource($identifier)
  22918. {
  22919. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22920. }
  22921. public function getDist($identifier)
  22922. {
  22923. return null;
  22924. }
  22925. public function getFileContent($file, $identifier)
  22926. {
  22927. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22928. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22929. if (!trim($content)) {
  22930. return null;
  22931. }
  22932. return $content;
  22933. }
  22934. public function getChangeDate($identifier)
  22935. {
  22936. $this->process->execute(sprintf(
  22937. 'git log -1 --format=%%at %s',
  22938. ProcessExecutor::escape($identifier)
  22939. ), $output, $this->repoDir);
  22940. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22941. }
  22942. public function getTags()
  22943. {
  22944. if (null === $this->tags) {
  22945. $this->tags = array();
  22946. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22947. foreach ($output = $this->process->splitLines($output) as $tag) {
  22948. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22949. $this->tags[$match[2]] = $match[1];
  22950. }
  22951. }
  22952. }
  22953. return $this->tags;
  22954. }
  22955. public function getBranches()
  22956. {
  22957. if (null === $this->branches) {
  22958. $branches = array();
  22959. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22960. foreach ($this->process->splitLines($output) as $branch) {
  22961. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22962. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22963. $branches[$match[1]] = $match[2];
  22964. }
  22965. }
  22966. }
  22967. $this->branches = $branches;
  22968. }
  22969. return $this->branches;
  22970. }
  22971. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22972. {
  22973. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22974. return true;
  22975. }
  22976. if (Filesystem::isLocalPath($url)) {
  22977. $url = Filesystem::getPlatformPath($url);
  22978. if (!is_dir($url)) {
  22979. return false;
  22980. }
  22981. $process = new ProcessExecutor($io);
  22982. if ($process->execute('git tag', $output, $url) === 0) {
  22983. return true;
  22984. }
  22985. }
  22986. if (!$deep) {
  22987. return false;
  22988. }
  22989. $process = new ProcessExecutor($io);
  22990. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22991. }
  22992. }
  22993. <?php
  22994. namespace Composer\Repository\Vcs;
  22995. use Composer\Config;
  22996. use Composer\Downloader\TransportException;
  22997. use Composer\Json\JsonFile;
  22998. use Composer\Cache;
  22999. use Composer\IO\IOInterface;
  23000. use Composer\Util\GitHub;
  23001. class GitHubDriver extends VcsDriver
  23002. {
  23003. protected $cache;
  23004. protected $owner;
  23005. protected $repository;
  23006. protected $tags;
  23007. protected $branches;
  23008. protected $rootIdentifier;
  23009. protected $repoData;
  23010. protected $hasIssues;
  23011. protected $infoCache = array();
  23012. protected $isPrivate = false;
  23013. protected $gitDriver;
  23014. public function initialize()
  23015. {
  23016. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23017. $this->owner = $match[3];
  23018. $this->repository = $match[4];
  23019. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  23020. if ($this->originUrl === 'www.github.com') {
  23021. $this->originUrl = 'github.com';
  23022. }
  23023. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23024. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23025. $this->setupGitDriver($this->url);
  23026. return;
  23027. }
  23028. $this->fetchRootIdentifier();
  23029. }
  23030. public function getRepositoryUrl()
  23031. {
  23032. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23033. }
  23034. public function getRootIdentifier()
  23035. {
  23036. if ($this->gitDriver) {
  23037. return $this->gitDriver->getRootIdentifier();
  23038. }
  23039. return $this->rootIdentifier;
  23040. }
  23041. public function getUrl()
  23042. {
  23043. if ($this->gitDriver) {
  23044. return $this->gitDriver->getUrl();
  23045. }
  23046. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23047. }
  23048. protected function getApiUrl()
  23049. {
  23050. if ('github.com' === $this->originUrl) {
  23051. $apiUrl = 'api.github.com';
  23052. } else {
  23053. $apiUrl = $this->originUrl . '/api/v3';
  23054. }
  23055. return 'https://' . $apiUrl;
  23056. }
  23057. public function getSource($identifier)
  23058. {
  23059. if ($this->gitDriver) {
  23060. return $this->gitDriver->getSource($identifier);
  23061. }
  23062. if ($this->isPrivate) {
  23063. $url = $this->generateSshUrl();
  23064. } else {
  23065. $url = $this->getUrl();
  23066. }
  23067. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23068. }
  23069. public function getDist($identifier)
  23070. {
  23071. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23072. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23073. }
  23074. public function getComposerInformation($identifier)
  23075. {
  23076. if ($this->gitDriver) {
  23077. return $this->gitDriver->getComposerInformation($identifier);
  23078. }
  23079. if (!isset($this->infoCache[$identifier])) {
  23080. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23081. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23082. }
  23083. $composer = $this->getBaseComposerInformation($identifier);
  23084. if ($composer) {
  23085. if (!isset($composer['support']['source'])) {
  23086. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23087. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23088. }
  23089. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23090. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23091. }
  23092. }
  23093. if ($this->shouldCache($identifier)) {
  23094. $this->cache->write($identifier, json_encode($composer));
  23095. }
  23096. $this->infoCache[$identifier] = $composer;
  23097. }
  23098. return $this->infoCache[$identifier];
  23099. }
  23100. public function getFileContent($file, $identifier)
  23101. {
  23102. if ($this->gitDriver) {
  23103. return $this->gitDriver->getFileContent($file, $identifier);
  23104. }
  23105. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  23106. $resource = JsonFile::parseJson($this->getContents($resource));
  23107. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  23108. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  23109. }
  23110. return $content;
  23111. }
  23112. public function getChangeDate($identifier)
  23113. {
  23114. if ($this->gitDriver) {
  23115. return $this->gitDriver->getChangeDate($identifier);
  23116. }
  23117. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  23118. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  23119. return new \DateTime($commit['commit']['committer']['date']);
  23120. }
  23121. public function getTags()
  23122. {
  23123. if ($this->gitDriver) {
  23124. return $this->gitDriver->getTags();
  23125. }
  23126. if (null === $this->tags) {
  23127. $this->tags = array();
  23128. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  23129. do {
  23130. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  23131. foreach ($tagsData as $tag) {
  23132. $this->tags[$tag['name']] = $tag['commit']['sha'];
  23133. }
  23134. $resource = $this->getNextPage();
  23135. } while ($resource);
  23136. }
  23137. return $this->tags;
  23138. }
  23139. public function getBranches()
  23140. {
  23141. if ($this->gitDriver) {
  23142. return $this->gitDriver->getBranches();
  23143. }
  23144. if (null === $this->branches) {
  23145. $this->branches = array();
  23146. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  23147. $branchBlacklist = array('gh-pages');
  23148. do {
  23149. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  23150. foreach ($branchData as $branch) {
  23151. $name = substr($branch['ref'], 11);
  23152. if (!in_array($name, $branchBlacklist)) {
  23153. $this->branches[$name] = $branch['object']['sha'];
  23154. }
  23155. }
  23156. $resource = $this->getNextPage();
  23157. } while ($resource);
  23158. }
  23159. return $this->branches;
  23160. }
  23161. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23162. {
  23163. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  23164. return false;
  23165. }
  23166. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  23167. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  23168. return false;
  23169. }
  23170. if (!extension_loaded('openssl')) {
  23171. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23172. return false;
  23173. }
  23174. return true;
  23175. }
  23176. public function getRepoData()
  23177. {
  23178. $this->fetchRootIdentifier();
  23179. return $this->repoData;
  23180. }
  23181. protected function generateSshUrl()
  23182. {
  23183. if (false !== strpos($this->originUrl, ':')) {
  23184. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23185. }
  23186. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  23187. }
  23188. protected function getContents($url, $fetchingRepoData = false)
  23189. {
  23190. try {
  23191. return parent::getContents($url);
  23192. } catch (TransportException $e) {
  23193. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23194. switch ($e->getCode()) {
  23195. case 401:
  23196. case 404:
  23197. if (!$fetchingRepoData) {
  23198. throw $e;
  23199. }
  23200. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  23201. return parent::getContents($url);
  23202. }
  23203. if (!$this->io->isInteractive()) {
  23204. return $this->attemptCloneFallback();
  23205. }
  23206. $scopesIssued = array();
  23207. $scopesNeeded = array();
  23208. if ($headers = $e->getHeaders()) {
  23209. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  23210. $scopesIssued = explode(' ', $scopes);
  23211. }
  23212. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  23213. $scopesNeeded = explode(' ', $scopes);
  23214. }
  23215. }
  23216. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  23217. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  23218. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23219. }
  23220. return parent::getContents($url);
  23221. case 403:
  23222. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  23223. return parent::getContents($url);
  23224. }
  23225. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23226. return $this->attemptCloneFallback();
  23227. }
  23228. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  23229. if (!$this->io->hasAuthentication($this->originUrl)) {
  23230. if (!$this->io->isInteractive()) {
  23231. $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>');
  23232. throw $e;
  23233. }
  23234. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  23235. return parent::getContents($url);
  23236. }
  23237. if ($rateLimited) {
  23238. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  23239. $this->io->writeError(sprintf(
  23240. '<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>',
  23241. $rateLimit['limit'],
  23242. $rateLimit['reset']
  23243. ));
  23244. }
  23245. throw $e;
  23246. default:
  23247. throw $e;
  23248. }
  23249. }
  23250. }
  23251. protected function fetchRootIdentifier()
  23252. {
  23253. if ($this->repoData) {
  23254. return;
  23255. }
  23256. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  23257. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  23258. if (null === $this->repoData && null !== $this->gitDriver) {
  23259. return;
  23260. }
  23261. $this->owner = $this->repoData['owner']['login'];
  23262. $this->repository = $this->repoData['name'];
  23263. $this->isPrivate = !empty($this->repoData['private']);
  23264. if (isset($this->repoData['default_branch'])) {
  23265. $this->rootIdentifier = $this->repoData['default_branch'];
  23266. } elseif (isset($this->repoData['master_branch'])) {
  23267. $this->rootIdentifier = $this->repoData['master_branch'];
  23268. } else {
  23269. $this->rootIdentifier = 'master';
  23270. }
  23271. $this->hasIssues = !empty($this->repoData['has_issues']);
  23272. }
  23273. protected function attemptCloneFallback()
  23274. {
  23275. $this->isPrivate = true;
  23276. try {
  23277. $this->setupGitDriver($this->generateSshUrl());
  23278. return;
  23279. } catch (\RuntimeException $e) {
  23280. $this->gitDriver = null;
  23281. $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>');
  23282. throw $e;
  23283. }
  23284. }
  23285. protected function setupGitDriver($url)
  23286. {
  23287. $this->gitDriver = new GitDriver(
  23288. array('url' => $url),
  23289. $this->io,
  23290. $this->config,
  23291. $this->process,
  23292. $this->remoteFilesystem
  23293. );
  23294. $this->gitDriver->initialize();
  23295. }
  23296. protected function getNextPage()
  23297. {
  23298. $headers = $this->remoteFilesystem->getLastHeaders();
  23299. foreach ($headers as $header) {
  23300. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23301. $links = explode(',', $match[1]);
  23302. foreach ($links as $link) {
  23303. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23304. return $match[1];
  23305. }
  23306. }
  23307. }
  23308. }
  23309. }
  23310. }
  23311. <?php
  23312. namespace Composer\Repository\Vcs;
  23313. use Composer\Config;
  23314. use Composer\Cache;
  23315. use Composer\IO\IOInterface;
  23316. use Composer\Json\JsonFile;
  23317. use Composer\Downloader\TransportException;
  23318. use Composer\Util\RemoteFilesystem;
  23319. use Composer\Util\GitLab;
  23320. class GitLabDriver extends VcsDriver
  23321. {
  23322. private $scheme;
  23323. private $namespace;
  23324. private $repository;
  23325. private $project;
  23326. private $commits = array();
  23327. private $tags;
  23328. private $branches;
  23329. protected $gitDriver;
  23330. private $isPrivate = true;
  23331. private $hasNonstandardOrigin = false;
  23332. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  23333. public function initialize()
  23334. {
  23335. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  23336. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  23337. }
  23338. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23339. $configuredDomains = $this->config->get('gitlab-domains');
  23340. $urlParts = explode('/', $match['parts']);
  23341. $this->scheme = !empty($match['scheme'])
  23342. ? $match['scheme']
  23343. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  23344. ;
  23345. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  23346. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  23347. $this->hasNonstandardOrigin = true;
  23348. }
  23349. $this->namespace = implode('/', $urlParts);
  23350. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  23351. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  23352. $this->fetchProject();
  23353. }
  23354. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  23355. {
  23356. $this->remoteFilesystem = $remoteFilesystem;
  23357. }
  23358. public function getFileContent($file, $identifier)
  23359. {
  23360. if ($this->gitDriver) {
  23361. return $this->gitDriver->getFileContent($file, $identifier);
  23362. }
  23363. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  23364. $branches = $this->getBranches();
  23365. if (isset($branches[$identifier])) {
  23366. $identifier = $branches[$identifier];
  23367. }
  23368. }
  23369. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  23370. try {
  23371. $content = $this->getContents($resource);
  23372. } catch (TransportException $e) {
  23373. if ($e->getCode() !== 404) {
  23374. throw $e;
  23375. }
  23376. return null;
  23377. }
  23378. return $content;
  23379. }
  23380. public function getChangeDate($identifier)
  23381. {
  23382. if ($this->gitDriver) {
  23383. return $this->gitDriver->getChangeDate($identifier);
  23384. }
  23385. if (isset($this->commits[$identifier])) {
  23386. return new \DateTime($this->commits[$identifier]['committed_date']);
  23387. }
  23388. return new \DateTime();
  23389. }
  23390. public function getRepositoryUrl()
  23391. {
  23392. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  23393. }
  23394. public function getUrl()
  23395. {
  23396. if ($this->gitDriver) {
  23397. return $this->gitDriver->getUrl();
  23398. }
  23399. return $this->project['web_url'];
  23400. }
  23401. public function getDist($identifier)
  23402. {
  23403. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  23404. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23405. }
  23406. public function getSource($identifier)
  23407. {
  23408. if ($this->gitDriver) {
  23409. return $this->gitDriver->getSource($identifier);
  23410. }
  23411. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  23412. }
  23413. public function getRootIdentifier()
  23414. {
  23415. if ($this->gitDriver) {
  23416. return $this->gitDriver->getRootIdentifier();
  23417. }
  23418. return $this->project['default_branch'];
  23419. }
  23420. public function getBranches()
  23421. {
  23422. if ($this->gitDriver) {
  23423. return $this->gitDriver->getBranches();
  23424. }
  23425. if (!$this->branches) {
  23426. $this->branches = $this->getReferences('branches');
  23427. }
  23428. return $this->branches;
  23429. }
  23430. public function getTags()
  23431. {
  23432. if ($this->gitDriver) {
  23433. return $this->gitDriver->getTags();
  23434. }
  23435. if (!$this->tags) {
  23436. $this->tags = $this->getReferences('tags');
  23437. }
  23438. return $this->tags;
  23439. }
  23440. public function getApiUrl()
  23441. {
  23442. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23443. }
  23444. private function urlEncodeAll($string)
  23445. {
  23446. $encoded = '';
  23447. for ($i = 0; isset($string[$i]); $i++) {
  23448. $character = $string[$i];
  23449. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23450. $character = '%' . sprintf('%02X', ord($character));
  23451. }
  23452. $encoded .= $character;
  23453. }
  23454. return $encoded;
  23455. }
  23456. protected function getReferences($type)
  23457. {
  23458. $perPage = 100;
  23459. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23460. $references = array();
  23461. do {
  23462. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23463. foreach ($data as $datum) {
  23464. $references[$datum['name']] = $datum['commit']['id'];
  23465. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23466. }
  23467. if (count($data) >= $perPage) {
  23468. $resource = $this->getNextPage();
  23469. } else {
  23470. $resource = false;
  23471. }
  23472. } while ($resource);
  23473. return $references;
  23474. }
  23475. protected function fetchProject()
  23476. {
  23477. $resource = $this->getApiUrl();
  23478. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23479. if (isset($this->project['visibility'])) {
  23480. $this->isPrivate = $this->project['visibility'] !== 'public';
  23481. } else {
  23482. $this->isPrivate = false;
  23483. }
  23484. }
  23485. protected function attemptCloneFallback()
  23486. {
  23487. try {
  23488. if ($this->isPrivate === false) {
  23489. $url = $this->generatePublicUrl();
  23490. } else {
  23491. $url = $this->generateSshUrl();
  23492. }
  23493. $this->setupGitDriver($url);
  23494. return;
  23495. } catch (\RuntimeException $e) {
  23496. $this->gitDriver = null;
  23497. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23498. throw $e;
  23499. }
  23500. }
  23501. protected function generateSshUrl()
  23502. {
  23503. if ($this->hasNonstandardOrigin) {
  23504. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  23505. }
  23506. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23507. }
  23508. protected function generatePublicUrl()
  23509. {
  23510. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23511. }
  23512. protected function setupGitDriver($url)
  23513. {
  23514. $this->gitDriver = new GitDriver(
  23515. array('url' => $url),
  23516. $this->io,
  23517. $this->config,
  23518. $this->process,
  23519. $this->remoteFilesystem
  23520. );
  23521. $this->gitDriver->initialize();
  23522. }
  23523. protected function getContents($url, $fetchingRepoData = false)
  23524. {
  23525. try {
  23526. $res = parent::getContents($url);
  23527. if ($fetchingRepoData) {
  23528. $json = JsonFile::parseJson($res, $url);
  23529. if (!isset($json['default_branch'])) {
  23530. if (!empty($json['id'])) {
  23531. $this->isPrivate = false;
  23532. }
  23533. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23534. }
  23535. }
  23536. return $res;
  23537. } catch (TransportException $e) {
  23538. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23539. switch ($e->getCode()) {
  23540. case 401:
  23541. case 404:
  23542. if (!$fetchingRepoData) {
  23543. throw $e;
  23544. }
  23545. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23546. return parent::getContents($url);
  23547. }
  23548. if (!$this->io->isInteractive()) {
  23549. return $this->attemptCloneFallback();
  23550. }
  23551. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23552. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23553. return parent::getContents($url);
  23554. case 403:
  23555. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23556. return parent::getContents($url);
  23557. }
  23558. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23559. return $this->attemptCloneFallback();
  23560. }
  23561. throw $e;
  23562. default:
  23563. throw $e;
  23564. }
  23565. }
  23566. }
  23567. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23568. {
  23569. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23570. return false;
  23571. }
  23572. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23573. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23574. $urlParts = explode('/', $match['parts']);
  23575. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  23576. return false;
  23577. }
  23578. if ('https' === $scheme && !extension_loaded('openssl')) {
  23579. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23580. return false;
  23581. }
  23582. return true;
  23583. }
  23584. private function getNextPage()
  23585. {
  23586. $headers = $this->remoteFilesystem->getLastHeaders();
  23587. foreach ($headers as $header) {
  23588. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23589. $links = explode(',', $match[1]);
  23590. foreach ($links as $link) {
  23591. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23592. return $match[1];
  23593. }
  23594. }
  23595. }
  23596. }
  23597. }
  23598. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  23599. {
  23600. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  23601. if ($portNumber) {
  23602. return $guessedDomain.':'.$portNumber;
  23603. }
  23604. return $guessedDomain;
  23605. }
  23606. if ($portNumber) {
  23607. $guessedDomain .= ':'.$portNumber;
  23608. }
  23609. while (null !== ($part = array_shift($urlParts))) {
  23610. $guessedDomain .= '/' . $part;
  23611. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  23612. return $guessedDomain;
  23613. }
  23614. }
  23615. return false;
  23616. }
  23617. }
  23618. <?php
  23619. namespace Composer\Repository\Vcs;
  23620. use Composer\Config;
  23621. use Composer\IO\IOInterface;
  23622. class HgBitbucketDriver extends BitbucketDriver
  23623. {
  23624. public function getRootIdentifier()
  23625. {
  23626. if ($this->fallbackDriver) {
  23627. return $this->fallbackDriver->getRootIdentifier();
  23628. }
  23629. if (null === $this->rootIdentifier) {
  23630. if (! $this->getRepoData()) {
  23631. return $this->fallbackDriver->getRootIdentifier();
  23632. }
  23633. if ($this->vcsType !== 'hg') {
  23634. throw new \RuntimeException(
  23635. $this->url.' does not appear to be a mercurial repository, use '.
  23636. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23637. );
  23638. }
  23639. $mainBranchData = $this->getMainBranchData();
  23640. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23641. }
  23642. return $this->rootIdentifier;
  23643. }
  23644. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23645. {
  23646. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  23647. return false;
  23648. }
  23649. if (!extension_loaded('openssl')) {
  23650. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23651. return false;
  23652. }
  23653. return true;
  23654. }
  23655. protected function setupFallbackDriver($url)
  23656. {
  23657. $this->fallbackDriver = new HgDriver(
  23658. array('url' => $url),
  23659. $this->io,
  23660. $this->config,
  23661. $this->process,
  23662. $this->remoteFilesystem
  23663. );
  23664. $this->fallbackDriver->initialize();
  23665. }
  23666. protected function generateSshUrl()
  23667. {
  23668. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23669. }
  23670. }
  23671. <?php
  23672. namespace Composer\Repository\Vcs;
  23673. use Composer\Config;
  23674. use Composer\Cache;
  23675. use Composer\Util\Hg as HgUtils;
  23676. use Composer\Util\ProcessExecutor;
  23677. use Composer\Util\Filesystem;
  23678. use Composer\IO\IOInterface;
  23679. class HgDriver extends VcsDriver
  23680. {
  23681. protected $tags;
  23682. protected $branches;
  23683. protected $rootIdentifier;
  23684. protected $repoDir;
  23685. protected $infoCache = array();
  23686. public function initialize()
  23687. {
  23688. if (Filesystem::isLocalPath($this->url)) {
  23689. $this->repoDir = $this->url;
  23690. } else {
  23691. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23692. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23693. }
  23694. $cacheDir = $this->config->get('cache-vcs-dir');
  23695. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23696. $fs = new Filesystem();
  23697. $fs->ensureDirectoryExists($cacheDir);
  23698. if (!is_writable(dirname($this->repoDir))) {
  23699. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23700. }
  23701. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23702. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23703. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23704. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23705. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23706. }
  23707. } else {
  23708. $fs->removeDirectory($this->repoDir);
  23709. $repoDir = $this->repoDir;
  23710. $command = function ($url) use ($repoDir) {
  23711. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  23712. };
  23713. $hgUtils->runCommand($command, $this->url, $this->repoDir);
  23714. }
  23715. }
  23716. $this->getTags();
  23717. $this->getBranches();
  23718. }
  23719. public function getRootIdentifier()
  23720. {
  23721. if (null === $this->rootIdentifier) {
  23722. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23723. $output = $this->process->splitLines($output);
  23724. $this->rootIdentifier = $output[0];
  23725. }
  23726. return $this->rootIdentifier;
  23727. }
  23728. public function getUrl()
  23729. {
  23730. return $this->url;
  23731. }
  23732. public function getSource($identifier)
  23733. {
  23734. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23735. }
  23736. public function getDist($identifier)
  23737. {
  23738. return null;
  23739. }
  23740. public function getFileContent($file, $identifier)
  23741. {
  23742. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23743. $this->process->execute($resource, $content, $this->repoDir);
  23744. if (!trim($content)) {
  23745. return;
  23746. }
  23747. return $content;
  23748. }
  23749. public function getChangeDate($identifier)
  23750. {
  23751. $this->process->execute(
  23752. sprintf(
  23753. 'hg log --template "{date|rfc3339date}" -r %s',
  23754. ProcessExecutor::escape($identifier)
  23755. ),
  23756. $output,
  23757. $this->repoDir
  23758. );
  23759. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23760. }
  23761. public function getTags()
  23762. {
  23763. if (null === $this->tags) {
  23764. $tags = array();
  23765. $this->process->execute('hg tags', $output, $this->repoDir);
  23766. foreach ($this->process->splitLines($output) as $tag) {
  23767. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23768. $tags[$match[1]] = $match[2];
  23769. }
  23770. }
  23771. unset($tags['tip']);
  23772. $this->tags = $tags;
  23773. }
  23774. return $this->tags;
  23775. }
  23776. public function getBranches()
  23777. {
  23778. if (null === $this->branches) {
  23779. $branches = array();
  23780. $bookmarks = array();
  23781. $this->process->execute('hg branches', $output, $this->repoDir);
  23782. foreach ($this->process->splitLines($output) as $branch) {
  23783. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23784. $branches[$match[1]] = $match[2];
  23785. }
  23786. }
  23787. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23788. foreach ($this->process->splitLines($output) as $branch) {
  23789. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23790. $bookmarks[$match[1]] = $match[2];
  23791. }
  23792. }
  23793. $this->branches = array_merge($bookmarks, $branches);
  23794. }
  23795. return $this->branches;
  23796. }
  23797. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23798. {
  23799. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23800. return true;
  23801. }
  23802. if (Filesystem::isLocalPath($url)) {
  23803. $url = Filesystem::getPlatformPath($url);
  23804. if (!is_dir($url)) {
  23805. return false;
  23806. }
  23807. $process = new ProcessExecutor($io);
  23808. if ($process->execute('hg summary', $output, $url) === 0) {
  23809. return true;
  23810. }
  23811. }
  23812. if (!$deep) {
  23813. return false;
  23814. }
  23815. $processExecutor = new ProcessExecutor($io);
  23816. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23817. return $exit === 0;
  23818. }
  23819. }
  23820. <?php
  23821. namespace Composer\Repository\Vcs;
  23822. use Composer\Config;
  23823. use Composer\Cache;
  23824. use Composer\IO\IOInterface;
  23825. use Composer\Util\ProcessExecutor;
  23826. use Composer\Util\Perforce;
  23827. class PerforceDriver extends VcsDriver
  23828. {
  23829. protected $depot;
  23830. protected $branch;
  23831. protected $perforce;
  23832. public function initialize()
  23833. {
  23834. $this->depot = $this->repoConfig['depot'];
  23835. $this->branch = '';
  23836. if (!empty($this->repoConfig['branch'])) {
  23837. $this->branch = $this->repoConfig['branch'];
  23838. }
  23839. $this->initPerforce($this->repoConfig);
  23840. $this->perforce->p4Login();
  23841. $this->perforce->checkStream();
  23842. $this->perforce->writeP4ClientSpec();
  23843. $this->perforce->connectClient();
  23844. return true;
  23845. }
  23846. private function initPerforce($repoConfig)
  23847. {
  23848. if (!empty($this->perforce)) {
  23849. return;
  23850. }
  23851. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23852. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23853. }
  23854. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23855. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23856. }
  23857. public function getFileContent($file, $identifier)
  23858. {
  23859. return $this->perforce->getFileContent($file, $identifier);
  23860. }
  23861. public function getChangeDate($identifier)
  23862. {
  23863. return null;
  23864. }
  23865. public function getRootIdentifier()
  23866. {
  23867. return $this->branch;
  23868. }
  23869. public function getBranches()
  23870. {
  23871. return $this->perforce->getBranches();
  23872. }
  23873. public function getTags()
  23874. {
  23875. return $this->perforce->getTags();
  23876. }
  23877. public function getDist($identifier)
  23878. {
  23879. return null;
  23880. }
  23881. public function getSource($identifier)
  23882. {
  23883. $source = array(
  23884. 'type' => 'perforce',
  23885. 'url' => $this->repoConfig['url'],
  23886. 'reference' => $identifier,
  23887. 'p4user' => $this->perforce->getUser(),
  23888. );
  23889. return $source;
  23890. }
  23891. public function getUrl()
  23892. {
  23893. return $this->url;
  23894. }
  23895. public function hasComposerFile($identifier)
  23896. {
  23897. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23898. $composerInfoIdentifier = $identifier;
  23899. return !empty($composerInfo);
  23900. }
  23901. public function getContents($url)
  23902. {
  23903. return false;
  23904. }
  23905. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23906. {
  23907. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23908. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23909. }
  23910. return false;
  23911. }
  23912. public function cleanup()
  23913. {
  23914. $this->perforce->cleanupClientSpec();
  23915. $this->perforce = null;
  23916. }
  23917. public function getDepot()
  23918. {
  23919. return $this->depot;
  23920. }
  23921. public function getBranch()
  23922. {
  23923. return $this->branch;
  23924. }
  23925. }
  23926. <?php
  23927. namespace Composer\Repository\Vcs;
  23928. use Composer\Cache;
  23929. use Composer\Config;
  23930. use Composer\Json\JsonFile;
  23931. use Composer\Util\ProcessExecutor;
  23932. use Composer\Util\Filesystem;
  23933. use Composer\Util\Svn as SvnUtil;
  23934. use Composer\IO\IOInterface;
  23935. use Composer\Downloader\TransportException;
  23936. class SvnDriver extends VcsDriver
  23937. {
  23938. protected $cache;
  23939. protected $baseUrl;
  23940. protected $tags;
  23941. protected $branches;
  23942. protected $rootIdentifier;
  23943. protected $infoCache = array();
  23944. protected $trunkPath = 'trunk';
  23945. protected $branchesPath = 'branches';
  23946. protected $tagsPath = 'tags';
  23947. protected $packagePath = '';
  23948. protected $cacheCredentials = true;
  23949. private $util;
  23950. public function initialize()
  23951. {
  23952. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23953. SvnUtil::cleanEnv();
  23954. if (isset($this->repoConfig['trunk-path'])) {
  23955. $this->trunkPath = $this->repoConfig['trunk-path'];
  23956. }
  23957. if (isset($this->repoConfig['branches-path'])) {
  23958. $this->branchesPath = $this->repoConfig['branches-path'];
  23959. }
  23960. if (isset($this->repoConfig['tags-path'])) {
  23961. $this->tagsPath = $this->repoConfig['tags-path'];
  23962. }
  23963. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23964. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23965. }
  23966. if (isset($this->repoConfig['package-path'])) {
  23967. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23968. }
  23969. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23970. $this->baseUrl = substr($this->url, 0, $pos);
  23971. }
  23972. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23973. $this->getBranches();
  23974. $this->getTags();
  23975. }
  23976. public function getRootIdentifier()
  23977. {
  23978. return $this->rootIdentifier ?: $this->trunkPath;
  23979. }
  23980. public function getUrl()
  23981. {
  23982. return $this->url;
  23983. }
  23984. public function getSource($identifier)
  23985. {
  23986. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23987. }
  23988. public function getDist($identifier)
  23989. {
  23990. return null;
  23991. }
  23992. protected function shouldCache($identifier)
  23993. {
  23994. return $this->cache && preg_match('{@\d+$}', $identifier);
  23995. }
  23996. public function getComposerInformation($identifier)
  23997. {
  23998. if (!isset($this->infoCache[$identifier])) {
  23999. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  24000. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24001. }
  24002. try {
  24003. $composer = $this->getBaseComposerInformation($identifier);
  24004. } catch (TransportException $e) {
  24005. $message = $e->getMessage();
  24006. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  24007. throw $e;
  24008. }
  24009. $composer = '';
  24010. }
  24011. if ($this->shouldCache($identifier)) {
  24012. $this->cache->write($identifier.'.json', json_encode($composer));
  24013. }
  24014. $this->infoCache[$identifier] = $composer;
  24015. }
  24016. return $this->infoCache[$identifier];
  24017. }
  24018. public function getFileContent($file, $identifier)
  24019. {
  24020. $identifier = '/' . trim($identifier, '/') . '/';
  24021. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24022. if (!empty($match[2])) {
  24023. $path = $match[1];
  24024. $rev = $match[2];
  24025. } else {
  24026. $path = $identifier;
  24027. $rev = '';
  24028. }
  24029. try {
  24030. $resource = $path.$file;
  24031. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  24032. if (!trim($output)) {
  24033. return null;
  24034. }
  24035. } catch (\RuntimeException $e) {
  24036. throw new TransportException($e->getMessage());
  24037. }
  24038. return $output;
  24039. }
  24040. public function getChangeDate($identifier)
  24041. {
  24042. $identifier = '/' . trim($identifier, '/') . '/';
  24043. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24044. if (!empty($match[2])) {
  24045. $path = $match[1];
  24046. $rev = $match[2];
  24047. } else {
  24048. $path = $identifier;
  24049. $rev = '';
  24050. }
  24051. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  24052. foreach ($this->process->splitLines($output) as $line) {
  24053. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  24054. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  24055. }
  24056. }
  24057. return null;
  24058. }
  24059. public function getTags()
  24060. {
  24061. if (null === $this->tags) {
  24062. $this->tags = array();
  24063. if ($this->tagsPath !== false) {
  24064. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  24065. if ($output) {
  24066. foreach ($this->process->splitLines($output) as $line) {
  24067. $line = trim($line);
  24068. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24069. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24070. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  24071. '/' . $this->tagsPath . '/' . $match[2],
  24072. $match[1]
  24073. );
  24074. }
  24075. }
  24076. }
  24077. }
  24078. }
  24079. }
  24080. return $this->tags;
  24081. }
  24082. public function getBranches()
  24083. {
  24084. if (null === $this->branches) {
  24085. $this->branches = array();
  24086. if (false === $this->trunkPath) {
  24087. $trunkParent = $this->baseUrl . '/';
  24088. } else {
  24089. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  24090. }
  24091. $output = $this->execute('svn ls --verbose', $trunkParent);
  24092. if ($output) {
  24093. foreach ($this->process->splitLines($output) as $line) {
  24094. $line = trim($line);
  24095. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24096. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  24097. $this->branches['trunk'] = $this->buildIdentifier(
  24098. '/' . $this->trunkPath,
  24099. $match[1]
  24100. );
  24101. $this->rootIdentifier = $this->branches['trunk'];
  24102. break;
  24103. }
  24104. }
  24105. }
  24106. }
  24107. unset($output);
  24108. if ($this->branchesPath !== false) {
  24109. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  24110. if ($output) {
  24111. foreach ($this->process->splitLines(trim($output)) as $line) {
  24112. $line = trim($line);
  24113. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24114. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24115. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  24116. '/' . $this->branchesPath . '/' . $match[2],
  24117. $match[1]
  24118. );
  24119. }
  24120. }
  24121. }
  24122. }
  24123. }
  24124. }
  24125. return $this->branches;
  24126. }
  24127. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24128. {
  24129. $url = self::normalizeUrl($url);
  24130. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  24131. return true;
  24132. }
  24133. if (!$deep && !Filesystem::isLocalPath($url)) {
  24134. return false;
  24135. }
  24136. $processExecutor = new ProcessExecutor($io);
  24137. $exit = $processExecutor->execute(
  24138. "svn info --non-interactive ".ProcessExecutor::escape($url),
  24139. $ignoredOutput
  24140. );
  24141. if ($exit === 0) {
  24142. return true;
  24143. }
  24144. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  24145. return true;
  24146. }
  24147. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  24148. return true;
  24149. }
  24150. return false;
  24151. }
  24152. protected static function normalizeUrl($url)
  24153. {
  24154. $fs = new Filesystem();
  24155. if ($fs->isAbsolutePath($url)) {
  24156. return 'file://' . strtr($url, '\\', '/');
  24157. }
  24158. return $url;
  24159. }
  24160. protected function execute($command, $url)
  24161. {
  24162. if (null === $this->util) {
  24163. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  24164. $this->util->setCacheCredentials($this->cacheCredentials);
  24165. }
  24166. try {
  24167. return $this->util->execute($command, $url);
  24168. } catch (\RuntimeException $e) {
  24169. if (null === $this->util->binaryVersion()) {
  24170. 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());
  24171. }
  24172. throw new \RuntimeException(
  24173. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  24174. );
  24175. }
  24176. }
  24177. protected function buildIdentifier($baseDir, $revision)
  24178. {
  24179. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  24180. }
  24181. }
  24182. <?php
  24183. namespace Composer\Repository\Vcs;
  24184. use Composer\Cache;
  24185. use Composer\Downloader\TransportException;
  24186. use Composer\Config;
  24187. use Composer\Factory;
  24188. use Composer\IO\IOInterface;
  24189. use Composer\Json\JsonFile;
  24190. use Composer\Util\ProcessExecutor;
  24191. use Composer\Util\RemoteFilesystem;
  24192. use Composer\Util\Filesystem;
  24193. abstract class VcsDriver implements VcsDriverInterface
  24194. {
  24195. protected $url;
  24196. protected $originUrl;
  24197. protected $repoConfig;
  24198. protected $io;
  24199. protected $config;
  24200. protected $process;
  24201. protected $remoteFilesystem;
  24202. protected $infoCache = array();
  24203. protected $cache;
  24204. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24205. {
  24206. if (Filesystem::isLocalPath($repoConfig['url'])) {
  24207. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  24208. }
  24209. $this->url = $repoConfig['url'];
  24210. $this->originUrl = $repoConfig['url'];
  24211. $this->repoConfig = $repoConfig;
  24212. $this->io = $io;
  24213. $this->config = $config;
  24214. $this->process = $process ?: new ProcessExecutor($io);
  24215. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24216. }
  24217. protected function shouldCache($identifier)
  24218. {
  24219. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  24220. }
  24221. public function getComposerInformation($identifier)
  24222. {
  24223. if (!isset($this->infoCache[$identifier])) {
  24224. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24225. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24226. }
  24227. $composer = $this->getBaseComposerInformation($identifier);
  24228. if ($this->shouldCache($identifier)) {
  24229. $this->cache->write($identifier, json_encode($composer));
  24230. }
  24231. $this->infoCache[$identifier] = $composer;
  24232. }
  24233. return $this->infoCache[$identifier];
  24234. }
  24235. protected function getBaseComposerInformation($identifier)
  24236. {
  24237. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24238. if (!$composerFileContent) {
  24239. return null;
  24240. }
  24241. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  24242. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  24243. $composer['time'] = $changeDate->format(DATE_RFC3339);
  24244. }
  24245. return $composer;
  24246. }
  24247. public function hasComposerFile($identifier)
  24248. {
  24249. try {
  24250. return (bool) $this->getComposerInformation($identifier);
  24251. } catch (TransportException $e) {
  24252. }
  24253. return false;
  24254. }
  24255. protected function getScheme()
  24256. {
  24257. if (extension_loaded('openssl')) {
  24258. return 'https';
  24259. }
  24260. return 'http';
  24261. }
  24262. protected function getContents($url)
  24263. {
  24264. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  24265. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  24266. }
  24267. public function cleanup()
  24268. {
  24269. return;
  24270. }
  24271. }
  24272. <?php
  24273. namespace Composer\Repository\Vcs;
  24274. use Composer\Config;
  24275. use Composer\IO\IOInterface;
  24276. interface VcsDriverInterface
  24277. {
  24278. public function initialize();
  24279. public function getComposerInformation($identifier);
  24280. public function getFileContent($file, $identifier);
  24281. public function getChangeDate($identifier);
  24282. public function getRootIdentifier();
  24283. public function getBranches();
  24284. public function getTags();
  24285. public function getDist($identifier);
  24286. public function getSource($identifier);
  24287. public function getUrl();
  24288. public function hasComposerFile($identifier);
  24289. public function cleanup();
  24290. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  24291. }
  24292. <?php
  24293. namespace Composer\Repository;
  24294. use Composer\Downloader\TransportException;
  24295. use Composer\Repository\Vcs\VcsDriverInterface;
  24296. use Composer\Package\Version\VersionParser;
  24297. use Composer\Package\Loader\ArrayLoader;
  24298. use Composer\Package\Loader\ValidatingArrayLoader;
  24299. use Composer\Package\Loader\InvalidPackageException;
  24300. use Composer\Package\Loader\LoaderInterface;
  24301. use Composer\EventDispatcher\EventDispatcher;
  24302. use Composer\IO\IOInterface;
  24303. use Composer\Config;
  24304. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  24305. {
  24306. protected $url;
  24307. protected $packageName;
  24308. protected $isVerbose;
  24309. protected $isVeryVerbose;
  24310. protected $io;
  24311. protected $config;
  24312. protected $versionParser;
  24313. protected $type;
  24314. protected $loader;
  24315. protected $repoConfig;
  24316. protected $branchErrorOccurred = false;
  24317. private $drivers;
  24318. private $driver;
  24319. private $versionCache;
  24320. private $emptyReferences = array();
  24321. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  24322. {
  24323. parent::__construct();
  24324. $this->drivers = $drivers ?: array(
  24325. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  24326. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  24327. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  24328. 'git' => 'Composer\Repository\Vcs\GitDriver',
  24329. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  24330. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  24331. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  24332. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  24333. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  24334. );
  24335. $this->url = $repoConfig['url'];
  24336. $this->io = $io;
  24337. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  24338. $this->isVerbose = $io->isVerbose();
  24339. $this->isVeryVerbose = $io->isVeryVerbose();
  24340. $this->config = $config;
  24341. $this->repoConfig = $repoConfig;
  24342. $this->versionCache = $versionCache;
  24343. }
  24344. public function getRepoConfig()
  24345. {
  24346. return $this->repoConfig;
  24347. }
  24348. public function setLoader(LoaderInterface $loader)
  24349. {
  24350. $this->loader = $loader;
  24351. }
  24352. public function getDriver()
  24353. {
  24354. if ($this->driver) {
  24355. return $this->driver;
  24356. }
  24357. if (isset($this->drivers[$this->type])) {
  24358. $class = $this->drivers[$this->type];
  24359. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  24360. $this->driver->initialize();
  24361. return $this->driver;
  24362. }
  24363. foreach ($this->drivers as $driver) {
  24364. if ($driver::supports($this->io, $this->config, $this->url)) {
  24365. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24366. $this->driver->initialize();
  24367. return $this->driver;
  24368. }
  24369. }
  24370. foreach ($this->drivers as $driver) {
  24371. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  24372. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24373. $this->driver->initialize();
  24374. return $this->driver;
  24375. }
  24376. }
  24377. }
  24378. public function hadInvalidBranches()
  24379. {
  24380. return $this->branchErrorOccurred;
  24381. }
  24382. public function getEmptyReferences()
  24383. {
  24384. return $this->emptyReferences;
  24385. }
  24386. protected function initialize()
  24387. {
  24388. parent::initialize();
  24389. $isVerbose = $this->isVerbose;
  24390. $isVeryVerbose = $this->isVeryVerbose;
  24391. $driver = $this->getDriver();
  24392. if (!$driver) {
  24393. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  24394. }
  24395. $this->versionParser = new VersionParser;
  24396. if (!$this->loader) {
  24397. $this->loader = new ArrayLoader($this->versionParser);
  24398. }
  24399. try {
  24400. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  24401. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  24402. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  24403. }
  24404. } catch (\Exception $e) {
  24405. if ($isVeryVerbose) {
  24406. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  24407. }
  24408. }
  24409. foreach ($driver->getTags() as $tag => $identifier) {
  24410. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  24411. if ($isVeryVerbose) {
  24412. $this->io->writeError($msg);
  24413. } elseif ($isVerbose) {
  24414. $this->io->overwriteError($msg, false);
  24415. }
  24416. $tag = str_replace('release-', '', $tag);
  24417. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  24418. if ($cachedPackage) {
  24419. $this->addPackage($cachedPackage);
  24420. continue;
  24421. } elseif ($cachedPackage === false) {
  24422. $this->emptyReferences[] = $identifier;
  24423. continue;
  24424. }
  24425. if (!$parsedTag = $this->validateTag($tag)) {
  24426. if ($isVeryVerbose) {
  24427. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  24428. }
  24429. continue;
  24430. }
  24431. try {
  24432. if (!$data = $driver->getComposerInformation($identifier)) {
  24433. if ($isVeryVerbose) {
  24434. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  24435. }
  24436. $this->emptyReferences[] = $identifier;
  24437. continue;
  24438. }
  24439. if (isset($data['version'])) {
  24440. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  24441. } else {
  24442. $data['version'] = $tag;
  24443. $data['version_normalized'] = $parsedTag;
  24444. }
  24445. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  24446. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  24447. if ($data['version_normalized'] !== $parsedTag) {
  24448. if ($isVeryVerbose) {
  24449. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24450. }
  24451. continue;
  24452. }
  24453. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24454. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24455. if ($isVeryVerbose) {
  24456. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24457. }
  24458. continue;
  24459. }
  24460. if ($isVeryVerbose) {
  24461. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24462. }
  24463. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24464. } catch (\Exception $e) {
  24465. if ($e instanceof TransportException && $e->getCode() === 404) {
  24466. $this->emptyReferences[] = $identifier;
  24467. }
  24468. if ($isVeryVerbose) {
  24469. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24470. }
  24471. continue;
  24472. }
  24473. }
  24474. if (!$isVeryVerbose) {
  24475. $this->io->overwriteError('', false);
  24476. }
  24477. $branches = $driver->getBranches();
  24478. foreach ($branches as $branch => $identifier) {
  24479. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24480. if ($isVeryVerbose) {
  24481. $this->io->writeError($msg);
  24482. } elseif ($isVerbose) {
  24483. $this->io->overwriteError($msg, false);
  24484. }
  24485. if ($branch === 'trunk' && isset($branches['master'])) {
  24486. if ($isVeryVerbose) {
  24487. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24488. }
  24489. continue;
  24490. }
  24491. if (!$parsedBranch = $this->validateBranch($branch)) {
  24492. if ($isVeryVerbose) {
  24493. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24494. }
  24495. continue;
  24496. }
  24497. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24498. $version = 'dev-' . $branch;
  24499. } else {
  24500. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24501. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24502. }
  24503. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  24504. if ($cachedPackage) {
  24505. $this->addPackage($cachedPackage);
  24506. continue;
  24507. } elseif ($cachedPackage === false) {
  24508. $this->emptyReferences[] = $identifier;
  24509. continue;
  24510. }
  24511. try {
  24512. if (!$data = $driver->getComposerInformation($identifier)) {
  24513. if ($isVeryVerbose) {
  24514. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24515. }
  24516. $this->emptyReferences[] = $identifier;
  24517. continue;
  24518. }
  24519. $data['version'] = $version;
  24520. $data['version_normalized'] = $parsedBranch;
  24521. if ($isVeryVerbose) {
  24522. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24523. }
  24524. $packageData = $this->preProcess($driver, $data, $identifier);
  24525. $package = $this->loader->load($packageData);
  24526. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24527. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24528. }
  24529. $this->addPackage($package);
  24530. } catch (TransportException $e) {
  24531. if ($e->getCode() === 404) {
  24532. $this->emptyReferences[] = $identifier;
  24533. }
  24534. if ($isVeryVerbose) {
  24535. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24536. }
  24537. continue;
  24538. } catch (\Exception $e) {
  24539. if (!$isVeryVerbose) {
  24540. $this->io->writeError('');
  24541. }
  24542. $this->branchErrorOccurred = true;
  24543. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24544. $this->io->writeError('');
  24545. continue;
  24546. }
  24547. }
  24548. $driver->cleanup();
  24549. if (!$isVeryVerbose) {
  24550. $this->io->overwriteError('', false);
  24551. }
  24552. if (!$this->getPackages()) {
  24553. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24554. }
  24555. }
  24556. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24557. {
  24558. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24559. $data['name'] = $this->packageName ?: $dataPackageName;
  24560. if (!isset($data['dist'])) {
  24561. $data['dist'] = $driver->getDist($identifier);
  24562. }
  24563. if (!isset($data['source'])) {
  24564. $data['source'] = $driver->getSource($identifier);
  24565. }
  24566. return $data;
  24567. }
  24568. private function validateBranch($branch)
  24569. {
  24570. try {
  24571. return $this->versionParser->normalizeBranch($branch);
  24572. } catch (\Exception $e) {
  24573. }
  24574. return false;
  24575. }
  24576. private function validateTag($version)
  24577. {
  24578. try {
  24579. return $this->versionParser->normalize($version);
  24580. } catch (\Exception $e) {
  24581. }
  24582. return false;
  24583. }
  24584. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  24585. {
  24586. if (!$this->versionCache) {
  24587. return;
  24588. }
  24589. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24590. if ($cachedPackage === false) {
  24591. if ($isVeryVerbose) {
  24592. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  24593. }
  24594. return false;
  24595. }
  24596. if ($cachedPackage) {
  24597. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24598. if ($isVeryVerbose) {
  24599. $this->io->writeError($msg);
  24600. } elseif ($isVerbose) {
  24601. $this->io->overwriteError($msg, false);
  24602. }
  24603. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24604. if ($isVeryVerbose) {
  24605. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  24606. }
  24607. $cachedPackage = null;
  24608. }
  24609. }
  24610. if ($cachedPackage) {
  24611. return $this->loader->load($cachedPackage);
  24612. }
  24613. return null;
  24614. }
  24615. }
  24616. <?php
  24617. namespace Composer\Repository;
  24618. interface VersionCacheInterface
  24619. {
  24620. public function getVersionPackage($version, $identifier);
  24621. }
  24622. <?php
  24623. namespace Composer\Repository;
  24624. use Composer\Package\AliasPackage;
  24625. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24626. {
  24627. public function write()
  24628. {
  24629. }
  24630. public function reload()
  24631. {
  24632. }
  24633. public function getCanonicalPackages()
  24634. {
  24635. $packages = $this->getPackages();
  24636. $packagesByName = array();
  24637. foreach ($packages as $package) {
  24638. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24639. $packagesByName[$package->getName()] = $package;
  24640. }
  24641. }
  24642. $canonicalPackages = array();
  24643. foreach ($packagesByName as $package) {
  24644. while ($package instanceof AliasPackage) {
  24645. $package = $package->getAliasOf();
  24646. }
  24647. $canonicalPackages[] = $package;
  24648. }
  24649. return $canonicalPackages;
  24650. }
  24651. }
  24652. <?php
  24653. namespace Composer\Repository;
  24654. use Composer\Package\PackageInterface;
  24655. interface WritableRepositoryInterface extends RepositoryInterface
  24656. {
  24657. public function write();
  24658. public function addPackage(PackageInterface $package);
  24659. public function removePackage(PackageInterface $package);
  24660. public function getCanonicalPackages();
  24661. public function reload();
  24662. }
  24663. <?php
  24664. namespace Composer\Script;
  24665. class CommandEvent extends Event
  24666. {
  24667. }
  24668. <?php
  24669. namespace Composer\Script;
  24670. use Composer\Composer;
  24671. use Composer\IO\IOInterface;
  24672. use Composer\EventDispatcher\Event as BaseEvent;
  24673. class Event extends BaseEvent
  24674. {
  24675. private $composer;
  24676. private $io;
  24677. private $devMode;
  24678. private $originatingEvent;
  24679. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24680. {
  24681. parent::__construct($name, $args, $flags);
  24682. $this->composer = $composer;
  24683. $this->io = $io;
  24684. $this->devMode = $devMode;
  24685. $this->originatingEvent = null;
  24686. }
  24687. public function getComposer()
  24688. {
  24689. return $this->composer;
  24690. }
  24691. public function getIO()
  24692. {
  24693. return $this->io;
  24694. }
  24695. public function isDevMode()
  24696. {
  24697. return $this->devMode;
  24698. }
  24699. public function getOriginatingEvent()
  24700. {
  24701. return $this->originatingEvent;
  24702. }
  24703. public function setOriginatingEvent(BaseEvent $event)
  24704. {
  24705. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  24706. return $this;
  24707. }
  24708. private function calculateOriginatingEvent(BaseEvent $event)
  24709. {
  24710. if ($event instanceof Event && $event->getOriginatingEvent()) {
  24711. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  24712. }
  24713. return $event;
  24714. }
  24715. }
  24716. <?php
  24717. namespace Composer\Script;
  24718. use Composer\Installer\PackageEvent as BasePackageEvent;
  24719. class PackageEvent extends BasePackageEvent
  24720. {
  24721. }
  24722. <?php
  24723. namespace Composer\Script;
  24724. class ScriptEvents
  24725. {
  24726. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24727. const POST_INSTALL_CMD = 'post-install-cmd';
  24728. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24729. const POST_UPDATE_CMD = 'post-update-cmd';
  24730. const PRE_STATUS_CMD = 'pre-status-cmd';
  24731. const POST_STATUS_CMD = 'post-status-cmd';
  24732. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24733. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24734. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24735. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24736. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24737. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24738. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24739. const POST_PACKAGE_INSTALL = 'post-package-install';
  24740. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24741. const POST_PACKAGE_UPDATE = 'post-package-update';
  24742. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24743. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24744. }
  24745. <?php
  24746. namespace Composer\SelfUpdate;
  24747. class Keys
  24748. {
  24749. public static function fingerprint($path)
  24750. {
  24751. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24752. return implode(' ', array(
  24753. substr($hash, 0, 8),
  24754. substr($hash, 8, 8),
  24755. substr($hash, 16, 8),
  24756. substr($hash, 24, 8),
  24757. '',
  24758. substr($hash, 32, 8),
  24759. substr($hash, 40, 8),
  24760. substr($hash, 48, 8),
  24761. substr($hash, 56, 8),
  24762. ));
  24763. }
  24764. }
  24765. <?php
  24766. namespace Composer\SelfUpdate;
  24767. use Composer\Util\RemoteFilesystem;
  24768. use Composer\Config;
  24769. use Composer\Json\JsonFile;
  24770. class Versions
  24771. {
  24772. private $rfs;
  24773. private $config;
  24774. private $channel;
  24775. public function __construct(Config $config, RemoteFilesystem $rfs)
  24776. {
  24777. $this->rfs = $rfs;
  24778. $this->config = $config;
  24779. }
  24780. public function getChannel()
  24781. {
  24782. if ($this->channel) {
  24783. return $this->channel;
  24784. }
  24785. $channelFile = $this->config->get('home').'/update-channel';
  24786. if (file_exists($channelFile)) {
  24787. $channel = trim(file_get_contents($channelFile));
  24788. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24789. return $this->channel = $channel;
  24790. }
  24791. }
  24792. return $this->channel = 'stable';
  24793. }
  24794. public function setChannel($channel)
  24795. {
  24796. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24797. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24798. }
  24799. $channelFile = $this->config->get('home').'/update-channel';
  24800. $this->channel = $channel;
  24801. file_put_contents($channelFile, $channel.PHP_EOL);
  24802. }
  24803. public function getLatest()
  24804. {
  24805. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24806. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24807. foreach ($versions[$this->getChannel()] as $version) {
  24808. if ($version['min-php'] <= PHP_VERSION_ID) {
  24809. return $version;
  24810. }
  24811. }
  24812. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24813. }
  24814. }
  24815. <?php
  24816. namespace Composer\Util;
  24817. use Composer\Config;
  24818. use Composer\IO\IOInterface;
  24819. class AuthHelper
  24820. {
  24821. protected $io;
  24822. protected $config;
  24823. public function __construct(IOInterface $io, Config $config)
  24824. {
  24825. $this->io = $io;
  24826. $this->config = $config;
  24827. }
  24828. public function storeAuth($originUrl, $storeAuth)
  24829. {
  24830. $store = false;
  24831. $configSource = $this->config->getAuthConfigSource();
  24832. if ($storeAuth === true) {
  24833. $store = $configSource;
  24834. } elseif ($storeAuth === 'prompt') {
  24835. $answer = $this->io->askAndValidate(
  24836. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24837. function ($value) {
  24838. $input = strtolower(substr(trim($value), 0, 1));
  24839. if (in_array($input, array('y','n'))) {
  24840. return $input;
  24841. }
  24842. throw new \RuntimeException('Please answer (y)es or (n)o');
  24843. },
  24844. null,
  24845. 'y'
  24846. );
  24847. if ($answer === 'y') {
  24848. $store = $configSource;
  24849. }
  24850. }
  24851. if ($store) {
  24852. $store->addConfigSetting(
  24853. 'http-basic.'.$originUrl,
  24854. $this->io->getAuthentication($originUrl)
  24855. );
  24856. }
  24857. }
  24858. }
  24859. <?php
  24860. namespace Composer\Util;
  24861. use Composer\Factory;
  24862. use Composer\IO\IOInterface;
  24863. use Composer\Config;
  24864. use Composer\Downloader\TransportException;
  24865. class Bitbucket
  24866. {
  24867. private $io;
  24868. private $config;
  24869. private $process;
  24870. private $remoteFilesystem;
  24871. private $token = array();
  24872. private $time;
  24873. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24874. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24875. {
  24876. $this->io = $io;
  24877. $this->config = $config;
  24878. $this->process = $process ?: new ProcessExecutor($io);
  24879. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24880. $this->time = $time;
  24881. }
  24882. public function getToken()
  24883. {
  24884. if (!isset($this->token['access_token'])) {
  24885. return '';
  24886. }
  24887. return $this->token['access_token'];
  24888. }
  24889. public function authorizeOAuth($originUrl)
  24890. {
  24891. if ($originUrl !== 'bitbucket.org') {
  24892. return false;
  24893. }
  24894. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24895. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24896. return true;
  24897. }
  24898. return false;
  24899. }
  24900. private function requestAccessToken($originUrl)
  24901. {
  24902. try {
  24903. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24904. 'retry-auth-failure' => false,
  24905. 'http' => array(
  24906. 'method' => 'POST',
  24907. 'content' => 'grant_type=client_credentials',
  24908. ),
  24909. ));
  24910. $this->token = json_decode($json, true);
  24911. } catch (TransportException $e) {
  24912. if ($e->getCode() === 400) {
  24913. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24914. $this->io->writeError('This can have two reasons:');
  24915. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24916. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24917. return false;
  24918. } elseif (in_array($e->getCode(), array(403, 401))) {
  24919. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24920. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24921. return false;
  24922. }
  24923. throw $e;
  24924. }
  24925. return true;
  24926. }
  24927. public function authorizeOAuthInteractively($originUrl, $message = null)
  24928. {
  24929. if ($message) {
  24930. $this->io->writeError($message);
  24931. }
  24932. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24933. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24934. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24935. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  24936. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24937. if (!$consumerKey) {
  24938. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  24939. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24940. return false;
  24941. }
  24942. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  24943. if (!$consumerSecret) {
  24944. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  24945. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24946. return false;
  24947. }
  24948. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24949. if (!$this->requestAccessToken($originUrl)) {
  24950. return false;
  24951. }
  24952. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24953. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  24954. $this->io->writeError('<info>Consumer stored successfully.</info>');
  24955. return true;
  24956. }
  24957. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  24958. {
  24959. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  24960. return $this->token['access_token'];
  24961. }
  24962. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24963. if (!$this->requestAccessToken($originUrl)) {
  24964. return '';
  24965. }
  24966. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24967. return $this->token['access_token'];
  24968. }
  24969. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  24970. {
  24971. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  24972. $time = null === $this->time ? time() : $this->time;
  24973. $consumer = array(
  24974. "consumer-key" => $consumerKey,
  24975. "consumer-secret" => $consumerSecret,
  24976. "access-token" => $this->token['access_token'],
  24977. "access-token-expiration" => $time + $this->token['expires_in'],
  24978. );
  24979. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  24980. }
  24981. private function getTokenFromConfig($originUrl)
  24982. {
  24983. $authConfig = $this->config->get('bitbucket-oauth');
  24984. if (
  24985. !isset($authConfig[$originUrl]['access-token'])
  24986. || !isset($authConfig[$originUrl]['access-token-expiration'])
  24987. || time() > $authConfig[$originUrl]['access-token-expiration']
  24988. ) {
  24989. return false;
  24990. }
  24991. $this->token = array(
  24992. 'access_token' => $authConfig[$originUrl]['access-token'],
  24993. );
  24994. return true;
  24995. }
  24996. }
  24997. <?php
  24998. namespace Composer\Util;
  24999. class ComposerMirror
  25000. {
  25001. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  25002. {
  25003. if ($reference) {
  25004. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  25005. }
  25006. $version = strpos($version, '/') === false ? $version : md5($version);
  25007. return str_replace(
  25008. array('%package%', '%version%', '%reference%', '%type%'),
  25009. array($packageName, $version, $reference, $type),
  25010. $mirrorUrl
  25011. );
  25012. }
  25013. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  25014. {
  25015. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  25016. $url = 'gh-'.$match[1].'/'.$match[2];
  25017. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  25018. $url = 'bb-'.$match[1].'/'.$match[2];
  25019. } else {
  25020. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  25021. }
  25022. return str_replace(
  25023. array('%package%', '%normalizedUrl%', '%type%'),
  25024. array($packageName, $url, $type),
  25025. $mirrorUrl
  25026. );
  25027. }
  25028. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  25029. {
  25030. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  25031. }
  25032. }
  25033. <?php
  25034. namespace Composer\Util;
  25035. use Composer\Package\Loader\ArrayLoader;
  25036. use Composer\Package\Loader\ValidatingArrayLoader;
  25037. use Composer\Package\Loader\InvalidPackageException;
  25038. use Composer\Json\JsonValidationException;
  25039. use Composer\IO\IOInterface;
  25040. use Composer\Json\JsonFile;
  25041. use Composer\Spdx\SpdxLicenses;
  25042. class ConfigValidator
  25043. {
  25044. private $io;
  25045. public function __construct(IOInterface $io)
  25046. {
  25047. $this->io = $io;
  25048. }
  25049. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  25050. {
  25051. $errors = array();
  25052. $publishErrors = array();
  25053. $warnings = array();
  25054. $laxValid = false;
  25055. try {
  25056. $json = new JsonFile($file, null, $this->io);
  25057. $manifest = $json->read();
  25058. $json->validateSchema(JsonFile::LAX_SCHEMA);
  25059. $laxValid = true;
  25060. $json->validateSchema();
  25061. } catch (JsonValidationException $e) {
  25062. foreach ($e->getErrors() as $message) {
  25063. if ($laxValid) {
  25064. $publishErrors[] = $message;
  25065. } else {
  25066. $errors[] = $message;
  25067. }
  25068. }
  25069. } catch (\Exception $e) {
  25070. $errors[] = $e->getMessage();
  25071. return array($errors, $publishErrors, $warnings);
  25072. }
  25073. if (empty($manifest['license'])) {
  25074. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  25075. } else {
  25076. $licenses = (array) $manifest['license'];
  25077. foreach ($licenses as $key => $license) {
  25078. if ('proprietary' === $license) {
  25079. unset($licenses[$key]);
  25080. }
  25081. }
  25082. $licenseValidator = new SpdxLicenses();
  25083. foreach ($licenses as $license) {
  25084. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  25085. if ($spdxLicense && $spdxLicense[3]) {
  25086. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  25087. $warnings[] = sprintf(
  25088. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  25089. $license
  25090. );
  25091. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  25092. $warnings[] = sprintf(
  25093. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  25094. $license
  25095. );
  25096. } else {
  25097. $warnings[] = sprintf(
  25098. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  25099. $license
  25100. );
  25101. }
  25102. }
  25103. }
  25104. }
  25105. if (isset($manifest['version'])) {
  25106. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  25107. }
  25108. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  25109. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  25110. $suggestName = strtolower($suggestName);
  25111. $publishErrors[] = sprintf(
  25112. '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.',
  25113. $manifest['name'],
  25114. $suggestName
  25115. );
  25116. }
  25117. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  25118. $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.";
  25119. }
  25120. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  25121. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  25122. if (!empty($requireOverrides)) {
  25123. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  25124. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  25125. }
  25126. }
  25127. $require = isset($manifest['require']) ? $manifest['require'] : array();
  25128. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  25129. $packages = array_merge($require, $requireDev);
  25130. foreach ($packages as $package => $version) {
  25131. if (preg_match('/#/', $version) === 1) {
  25132. $warnings[] = sprintf(
  25133. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  25134. $package
  25135. );
  25136. }
  25137. }
  25138. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  25139. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  25140. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  25141. if (!array_key_exists($scriptName, $scripts)) {
  25142. $warnings[] = sprintf(
  25143. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  25144. $scriptName
  25145. );
  25146. }
  25147. }
  25148. if (isset($manifest['autoload']['psr-0'][''])) {
  25149. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  25150. }
  25151. if (isset($manifest['autoload']['psr-4'][''])) {
  25152. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  25153. }
  25154. try {
  25155. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  25156. if (!isset($manifest['version'])) {
  25157. $manifest['version'] = '1.0.0';
  25158. }
  25159. if (!isset($manifest['name'])) {
  25160. $manifest['name'] = 'dummy/dummy';
  25161. }
  25162. $loader->load($manifest);
  25163. } catch (InvalidPackageException $e) {
  25164. $errors = array_merge($errors, $e->getErrors());
  25165. }
  25166. $warnings = array_merge($warnings, $loader->getWarnings());
  25167. return array($errors, $publishErrors, $warnings);
  25168. }
  25169. }
  25170. <?php
  25171. namespace Composer\Util;
  25172. use Composer\IO\IOInterface;
  25173. class ErrorHandler
  25174. {
  25175. private static $io;
  25176. public static function handle($level, $message, $file, $line)
  25177. {
  25178. if (!(error_reporting() & $level)) {
  25179. return;
  25180. }
  25181. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  25182. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  25183. "\na legitimately suppressed error that you were not supposed to see.";
  25184. }
  25185. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  25186. throw new \ErrorException($message, 0, $level, $file, $line);
  25187. }
  25188. if (self::$io) {
  25189. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  25190. if (self::$io->isVerbose()) {
  25191. self::$io->writeError('<warning>Stack trace:</warning>');
  25192. self::$io->writeError(array_filter(array_map(function ($a) {
  25193. if (isset($a['line'], $a['file'])) {
  25194. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  25195. }
  25196. return null;
  25197. }, array_slice(debug_backtrace(), 2))));
  25198. }
  25199. }
  25200. return true;
  25201. }
  25202. public static function register(IOInterface $io = null)
  25203. {
  25204. set_error_handler(array(__CLASS__, 'handle'));
  25205. error_reporting(E_ALL | E_STRICT);
  25206. self::$io = $io;
  25207. }
  25208. }
  25209. <?php
  25210. namespace Composer\Util;
  25211. use RecursiveDirectoryIterator;
  25212. use RecursiveIteratorIterator;
  25213. use Symfony\Component\Filesystem\Exception\IOException;
  25214. use Symfony\Component\Finder\Finder;
  25215. class Filesystem
  25216. {
  25217. private $processExecutor;
  25218. public function __construct(ProcessExecutor $executor = null)
  25219. {
  25220. $this->processExecutor = $executor ?: new ProcessExecutor();
  25221. }
  25222. public function remove($file)
  25223. {
  25224. if (is_dir($file)) {
  25225. return $this->removeDirectory($file);
  25226. }
  25227. if (file_exists($file)) {
  25228. return $this->unlink($file);
  25229. }
  25230. return false;
  25231. }
  25232. public function isDirEmpty($dir)
  25233. {
  25234. $finder = Finder::create()
  25235. ->ignoreVCS(false)
  25236. ->ignoreDotFiles(false)
  25237. ->depth(0)
  25238. ->in($dir);
  25239. return count($finder) === 0;
  25240. }
  25241. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  25242. {
  25243. if (file_exists($dir) && is_link($dir)) {
  25244. $this->unlink($dir);
  25245. }
  25246. if ($ensureDirectoryExists) {
  25247. $this->ensureDirectoryExists($dir);
  25248. }
  25249. if (is_dir($dir)) {
  25250. $finder = Finder::create()
  25251. ->ignoreVCS(false)
  25252. ->ignoreDotFiles(false)
  25253. ->depth(0)
  25254. ->in($dir);
  25255. foreach ($finder as $path) {
  25256. $this->remove((string) $path);
  25257. }
  25258. }
  25259. }
  25260. public function removeDirectory($directory)
  25261. {
  25262. if ($this->isSymlinkedDirectory($directory)) {
  25263. return $this->unlinkSymlinkedDirectory($directory);
  25264. }
  25265. if ($this->isJunction($directory)) {
  25266. return $this->removeJunction($directory);
  25267. }
  25268. if (is_link($directory)) {
  25269. return unlink($directory);
  25270. }
  25271. if (!file_exists($directory) || !is_dir($directory)) {
  25272. return true;
  25273. }
  25274. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  25275. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  25276. }
  25277. if (!function_exists('proc_open')) {
  25278. return $this->removeDirectoryPhp($directory);
  25279. }
  25280. if (Platform::isWindows()) {
  25281. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  25282. } else {
  25283. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  25284. }
  25285. $result = $this->getProcess()->execute($cmd, $output) === 0;
  25286. clearstatcache();
  25287. if ($result && !file_exists($directory)) {
  25288. return true;
  25289. }
  25290. return $this->removeDirectoryPhp($directory);
  25291. }
  25292. public function removeDirectoryPhp($directory)
  25293. {
  25294. try {
  25295. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25296. } catch (\UnexpectedValueException $e) {
  25297. clearstatcache();
  25298. usleep(100000);
  25299. if (!is_dir($directory)) {
  25300. return true;
  25301. }
  25302. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25303. }
  25304. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25305. foreach ($ri as $file) {
  25306. if ($file->isDir()) {
  25307. $this->rmdir($file->getPathname());
  25308. } else {
  25309. $this->unlink($file->getPathname());
  25310. }
  25311. }
  25312. return $this->rmdir($directory);
  25313. }
  25314. public function ensureDirectoryExists($directory)
  25315. {
  25316. if (!is_dir($directory)) {
  25317. if (file_exists($directory)) {
  25318. throw new \RuntimeException(
  25319. $directory.' exists and is not a directory.'
  25320. );
  25321. }
  25322. if (!@mkdir($directory, 0777, true)) {
  25323. throw new \RuntimeException(
  25324. $directory.' does not exist and could not be created.'
  25325. );
  25326. }
  25327. }
  25328. }
  25329. public function unlink($path)
  25330. {
  25331. $unlinked = @$this->unlinkImplementation($path);
  25332. if (!$unlinked) {
  25333. if (Platform::isWindows()) {
  25334. usleep(350000);
  25335. $unlinked = @$this->unlinkImplementation($path);
  25336. }
  25337. if (!$unlinked) {
  25338. $error = error_get_last();
  25339. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25340. if (Platform::isWindows()) {
  25341. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25342. }
  25343. throw new \RuntimeException($message);
  25344. }
  25345. }
  25346. return true;
  25347. }
  25348. public function rmdir($path)
  25349. {
  25350. $deleted = @rmdir($path);
  25351. if (!$deleted) {
  25352. if (Platform::isWindows()) {
  25353. usleep(350000);
  25354. $deleted = @rmdir($path);
  25355. }
  25356. if (!$deleted) {
  25357. $error = error_get_last();
  25358. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25359. if (Platform::isWindows()) {
  25360. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25361. }
  25362. throw new \RuntimeException($message);
  25363. }
  25364. }
  25365. return true;
  25366. }
  25367. public function copyThenRemove($source, $target)
  25368. {
  25369. $this->copy($source, $target);
  25370. if (!is_dir($source)) {
  25371. $this->unlink($source);
  25372. return;
  25373. }
  25374. $this->removeDirectoryPhp($source);
  25375. }
  25376. public function copy($source, $target)
  25377. {
  25378. if (!is_dir($source)) {
  25379. return copy($source, $target);
  25380. }
  25381. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  25382. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  25383. $this->ensureDirectoryExists($target);
  25384. $result = true;
  25385. foreach ($ri as $file) {
  25386. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  25387. if ($file->isDir()) {
  25388. $this->ensureDirectoryExists($targetPath);
  25389. } else {
  25390. $result = $result && copy($file->getPathname(), $targetPath);
  25391. }
  25392. }
  25393. return $result;
  25394. }
  25395. public function rename($source, $target)
  25396. {
  25397. if (true === @rename($source, $target)) {
  25398. return;
  25399. }
  25400. if (!function_exists('proc_open')) {
  25401. return $this->copyThenRemove($source, $target);
  25402. }
  25403. if (Platform::isWindows()) {
  25404. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25405. $result = $this->processExecutor->execute($command, $output);
  25406. clearstatcache();
  25407. if (0 === $result) {
  25408. $this->remove($source);
  25409. return;
  25410. }
  25411. } else {
  25412. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25413. $result = $this->processExecutor->execute($command, $output);
  25414. clearstatcache();
  25415. if (0 === $result) {
  25416. return;
  25417. }
  25418. }
  25419. return $this->copyThenRemove($source, $target);
  25420. }
  25421. public function findShortestPath($from, $to, $directories = false)
  25422. {
  25423. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25424. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25425. }
  25426. $from = lcfirst($this->normalizePath($from));
  25427. $to = lcfirst($this->normalizePath($to));
  25428. if ($directories) {
  25429. $from = rtrim($from, '/') . '/dummy_file';
  25430. }
  25431. if (dirname($from) === dirname($to)) {
  25432. return './'.basename($to);
  25433. }
  25434. $commonPath = $to;
  25435. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  25436. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25437. }
  25438. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  25439. return $to;
  25440. }
  25441. $commonPath = rtrim($commonPath, '/') . '/';
  25442. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  25443. $commonPathCode = str_repeat('../', $sourcePathDepth);
  25444. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  25445. }
  25446. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  25447. {
  25448. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25449. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25450. }
  25451. $from = lcfirst($this->normalizePath($from));
  25452. $to = lcfirst($this->normalizePath($to));
  25453. if ($from === $to) {
  25454. return $directories ? '__DIR__' : '__FILE__';
  25455. }
  25456. $commonPath = $to;
  25457. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  25458. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25459. }
  25460. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  25461. return var_export($to, true);
  25462. }
  25463. $commonPath = rtrim($commonPath, '/') . '/';
  25464. if (strpos($to, $from.'/') === 0) {
  25465. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  25466. }
  25467. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  25468. if ($staticCode) {
  25469. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  25470. } else {
  25471. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  25472. }
  25473. $relTarget = substr($to, strlen($commonPath));
  25474. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  25475. }
  25476. public function isAbsolutePath($path)
  25477. {
  25478. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  25479. }
  25480. public function size($path)
  25481. {
  25482. if (!file_exists($path)) {
  25483. throw new \RuntimeException("$path does not exist.");
  25484. }
  25485. if (is_dir($path)) {
  25486. return $this->directorySize($path);
  25487. }
  25488. return filesize($path);
  25489. }
  25490. public function normalizePath($path)
  25491. {
  25492. $parts = array();
  25493. $path = strtr($path, '\\', '/');
  25494. $prefix = '';
  25495. $absolute = false;
  25496. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25497. $prefix = $match[1];
  25498. $path = substr($path, strlen($prefix));
  25499. }
  25500. if (substr($path, 0, 1) === '/') {
  25501. $absolute = true;
  25502. $path = substr($path, 1);
  25503. }
  25504. $up = false;
  25505. foreach (explode('/', $path) as $chunk) {
  25506. if ('..' === $chunk && ($absolute || $up)) {
  25507. array_pop($parts);
  25508. $up = !(empty($parts) || '..' === end($parts));
  25509. } elseif ('.' !== $chunk && '' !== $chunk) {
  25510. $parts[] = $chunk;
  25511. $up = '..' !== $chunk;
  25512. }
  25513. }
  25514. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25515. }
  25516. public static function isLocalPath($path)
  25517. {
  25518. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25519. }
  25520. public static function getPlatformPath($path)
  25521. {
  25522. if (Platform::isWindows()) {
  25523. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25524. }
  25525. return preg_replace('{^file://}i', '', $path);
  25526. }
  25527. protected function directorySize($directory)
  25528. {
  25529. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25530. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25531. $size = 0;
  25532. foreach ($ri as $file) {
  25533. if ($file->isFile()) {
  25534. $size += $file->getSize();
  25535. }
  25536. }
  25537. return $size;
  25538. }
  25539. protected function getProcess()
  25540. {
  25541. return $this->processExecutor;
  25542. }
  25543. private function unlinkImplementation($path)
  25544. {
  25545. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25546. return rmdir($path);
  25547. }
  25548. return unlink($path);
  25549. }
  25550. public function relativeSymlink($target, $link)
  25551. {
  25552. $cwd = getcwd();
  25553. $relativePath = $this->findShortestPath($link, $target);
  25554. chdir(dirname($link));
  25555. $result = @symlink($relativePath, $link);
  25556. chdir($cwd);
  25557. return $result;
  25558. }
  25559. public function isSymlinkedDirectory($directory)
  25560. {
  25561. if (!is_dir($directory)) {
  25562. return false;
  25563. }
  25564. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25565. return is_link($resolved);
  25566. }
  25567. private function unlinkSymlinkedDirectory($directory)
  25568. {
  25569. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25570. return $this->unlink($resolved);
  25571. }
  25572. private function resolveSymlinkedDirectorySymlink($pathname)
  25573. {
  25574. if (!is_dir($pathname)) {
  25575. return $pathname;
  25576. }
  25577. $resolved = rtrim($pathname, '/');
  25578. if (!strlen($resolved)) {
  25579. return $pathname;
  25580. }
  25581. return $resolved;
  25582. }
  25583. public function junction($target, $junction)
  25584. {
  25585. if (!Platform::isWindows()) {
  25586. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25587. }
  25588. if (!is_dir($target)) {
  25589. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25590. }
  25591. $cmd = sprintf(
  25592. 'mklink /J %s %s',
  25593. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25594. ProcessExecutor::escape(realpath($target))
  25595. );
  25596. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25597. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25598. }
  25599. clearstatcache(true, $junction);
  25600. }
  25601. public function isJunction($junction)
  25602. {
  25603. if (!Platform::isWindows()) {
  25604. return false;
  25605. }
  25606. if (!is_dir($junction) || is_link($junction)) {
  25607. return false;
  25608. }
  25609. clearstatcache(true, $junction);
  25610. $stat = lstat($junction);
  25611. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  25612. }
  25613. public function removeJunction($junction)
  25614. {
  25615. if (!Platform::isWindows()) {
  25616. return false;
  25617. }
  25618. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25619. if (!$this->isJunction($junction)) {
  25620. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25621. }
  25622. return $this->rmdir($junction);
  25623. }
  25624. }
  25625. <?php
  25626. namespace Composer\Util;
  25627. use Composer\Config;
  25628. use Composer\IO\IOInterface;
  25629. class Git
  25630. {
  25631. private static $version;
  25632. protected $io;
  25633. protected $config;
  25634. protected $process;
  25635. protected $filesystem;
  25636. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25637. {
  25638. $this->io = $io;
  25639. $this->config = $config;
  25640. $this->process = $process;
  25641. $this->filesystem = $fs;
  25642. }
  25643. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25644. {
  25645. $this->config->prohibitUrlByConfig($url, $this->io);
  25646. if ($initialClone) {
  25647. $origCwd = $cwd;
  25648. $cwd = null;
  25649. }
  25650. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25651. 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.');
  25652. }
  25653. if (!$initialClone) {
  25654. $this->process->execute('git remote -v', $output, $cwd);
  25655. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  25656. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25657. }
  25658. }
  25659. $protocols = $this->config->get('github-protocols');
  25660. if (!is_array($protocols)) {
  25661. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25662. }
  25663. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25664. $messages = array();
  25665. foreach ($protocols as $protocol) {
  25666. if ('ssh' === $protocol) {
  25667. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25668. } else {
  25669. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25670. }
  25671. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25672. return;
  25673. }
  25674. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25675. if ($initialClone) {
  25676. $this->filesystem->removeDirectory($origCwd);
  25677. }
  25678. }
  25679. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25680. }
  25681. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25682. $command = call_user_func($commandCallable, $url);
  25683. $auth = null;
  25684. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25685. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  25686. if (!$this->io->hasAuthentication($match[1])) {
  25687. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25688. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25689. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25690. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25691. }
  25692. }
  25693. if ($this->io->hasAuthentication($match[1])) {
  25694. $auth = $this->io->getAuthentication($match[1]);
  25695. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25696. $command = call_user_func($commandCallable, $authUrl);
  25697. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25698. return;
  25699. }
  25700. }
  25701. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25702. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25703. if (!$this->io->hasAuthentication($match[1])) {
  25704. $message = 'Enter your Bitbucket credentials to access private repos';
  25705. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25706. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25707. $accessToken = $bitbucketUtil->getToken();
  25708. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25709. }
  25710. } else {
  25711. $auth = $this->io->getAuthentication($match[1]);
  25712. if ($auth['username'] !== 'x-token-auth') {
  25713. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25714. if (! empty($accessToken)) {
  25715. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25716. }
  25717. }
  25718. }
  25719. if ($this->io->hasAuthentication($match[1])) {
  25720. $auth = $this->io->getAuthentication($match[1]);
  25721. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25722. $command = call_user_func($commandCallable, $authUrl);
  25723. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25724. return;
  25725. }
  25726. } else {
  25727. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25728. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25729. $command = call_user_func($commandCallable, $sshUrl);
  25730. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25731. return;
  25732. }
  25733. }
  25734. } elseif (preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25735. if (!$this->io->hasAuthentication($match[2])) {
  25736. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  25737. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  25738. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  25739. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  25740. }
  25741. }
  25742. if ($this->io->hasAuthentication($match[2])) {
  25743. $auth = $this->io->getAuthentication($match[2]);
  25744. if($auth['password'] === 'private-token' || $auth['password'] === 'oauth2') {
  25745. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  25746. } else {
  25747. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  25748. }
  25749. $command = call_user_func($commandCallable, $authUrl);
  25750. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25751. return;
  25752. }
  25753. }
  25754. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25755. if (strpos($match[2], '@')) {
  25756. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25757. }
  25758. $storeAuth = false;
  25759. if ($this->io->hasAuthentication($match[2])) {
  25760. $auth = $this->io->getAuthentication($match[2]);
  25761. } elseif ($this->io->isInteractive()) {
  25762. $defaultUsername = null;
  25763. if (isset($authParts) && $authParts) {
  25764. if (false !== strpos($authParts, ':')) {
  25765. list($defaultUsername, ) = explode(':', $authParts, 2);
  25766. } else {
  25767. $defaultUsername = $authParts;
  25768. }
  25769. }
  25770. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  25771. $auth = array(
  25772. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25773. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25774. );
  25775. $storeAuth = $this->config->get('store-auths');
  25776. }
  25777. if ($auth) {
  25778. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25779. $command = call_user_func($commandCallable, $authUrl);
  25780. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25781. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25782. $authHelper = new AuthHelper($this->io, $this->config);
  25783. $authHelper->storeAuth($match[2], $storeAuth);
  25784. return;
  25785. }
  25786. }
  25787. }
  25788. if ($initialClone) {
  25789. $this->filesystem->removeDirectory($origCwd);
  25790. }
  25791. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  25792. }
  25793. }
  25794. public function syncMirror($url, $dir)
  25795. {
  25796. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25797. try {
  25798. $commandCallable = function ($url) {
  25799. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  25800. };
  25801. $this->runCommand($commandCallable, $url, $dir);
  25802. } catch (\Exception $e) {
  25803. return false;
  25804. }
  25805. return true;
  25806. }
  25807. $this->filesystem->removeDirectory($dir);
  25808. $commandCallable = function ($url) use ($dir) {
  25809. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25810. };
  25811. $this->runCommand($commandCallable, $url, $dir, true);
  25812. return true;
  25813. }
  25814. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25815. {
  25816. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25817. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25818. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  25819. if ($exitCode === 0) {
  25820. return true;
  25821. }
  25822. }
  25823. $this->syncMirror($url, $dir);
  25824. return false;
  25825. }
  25826. private function isAuthenticationFailure($url, &$match)
  25827. {
  25828. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25829. return false;
  25830. }
  25831. $authFailures = array(
  25832. 'fatal: Authentication failed',
  25833. 'remote error: Invalid username or password.',
  25834. 'error: 401 Unauthorized',
  25835. 'fatal: unable to access',
  25836. 'fatal: could not read Username',
  25837. );
  25838. $errorOutput = $this->process->getErrorOutput();
  25839. foreach ($authFailures as $authFailure) {
  25840. if (strpos($errorOutput, $authFailure) !== false) {
  25841. return true;
  25842. }
  25843. }
  25844. return false;
  25845. }
  25846. public static function cleanEnv()
  25847. {
  25848. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25849. 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');
  25850. }
  25851. if (getenv('GIT_ASKPASS') !== 'echo') {
  25852. putenv('GIT_ASKPASS=echo');
  25853. unset($_SERVER['GIT_ASKPASS']);
  25854. }
  25855. if (getenv('GIT_DIR')) {
  25856. putenv('GIT_DIR');
  25857. unset($_SERVER['GIT_DIR']);
  25858. }
  25859. if (getenv('GIT_WORK_TREE')) {
  25860. putenv('GIT_WORK_TREE');
  25861. unset($_SERVER['GIT_WORK_TREE']);
  25862. }
  25863. if (getenv('LANGUAGE') !== 'C') {
  25864. putenv('LANGUAGE=C');
  25865. }
  25866. putenv("DYLD_LIBRARY_PATH");
  25867. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25868. }
  25869. public static function getGitHubDomainsRegex(Config $config)
  25870. {
  25871. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25872. }
  25873. public static function getGitLabDomainsRegex(Config $config)
  25874. {
  25875. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  25876. }
  25877. public static function sanitizeUrl($message)
  25878. {
  25879. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25880. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25881. return '://***:***@';
  25882. }
  25883. return '://' . $m[1] . ':***@';
  25884. }, $message);
  25885. }
  25886. private function throwException($message, $url)
  25887. {
  25888. clearstatcache();
  25889. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25890. 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()));
  25891. }
  25892. throw new \RuntimeException(self::sanitizeUrl($message));
  25893. }
  25894. public function getVersion()
  25895. {
  25896. if (isset(self::$version)) {
  25897. return self::$version;
  25898. }
  25899. if (0 !== $this->process->execute('git --version', $output)) {
  25900. return;
  25901. }
  25902. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25903. return self::$version = $matches[1];
  25904. }
  25905. }
  25906. }
  25907. <?php
  25908. namespace Composer\Util;
  25909. use Composer\Factory;
  25910. use Composer\IO\IOInterface;
  25911. use Composer\Config;
  25912. use Composer\Downloader\TransportException;
  25913. class GitHub
  25914. {
  25915. protected $io;
  25916. protected $config;
  25917. protected $process;
  25918. protected $remoteFilesystem;
  25919. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25920. {
  25921. $this->io = $io;
  25922. $this->config = $config;
  25923. $this->process = $process ?: new ProcessExecutor($io);
  25924. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25925. }
  25926. public function authorizeOAuth($originUrl)
  25927. {
  25928. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  25929. return false;
  25930. }
  25931. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  25932. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  25933. return true;
  25934. }
  25935. return false;
  25936. }
  25937. public function authorizeOAuthInteractively($originUrl, $message = null)
  25938. {
  25939. if ($message) {
  25940. $this->io->writeError($message);
  25941. }
  25942. $note = 'Composer';
  25943. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  25944. $note .= ' on ' . trim($output);
  25945. }
  25946. $note .= ' ' . date('Y-m-d Hi');
  25947. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  25948. $this->io->writeError(sprintf('Head to %s', $url));
  25949. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25950. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  25951. if (!$token) {
  25952. $this->io->writeError('<warning>No token given, aborting.</warning>');
  25953. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25954. return false;
  25955. }
  25956. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  25957. try {
  25958. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  25959. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  25960. 'retry-auth-failure' => false,
  25961. ));
  25962. } catch (TransportException $e) {
  25963. if (in_array($e->getCode(), array(403, 401))) {
  25964. $this->io->writeError('<error>Invalid token provided.</error>');
  25965. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25966. return false;
  25967. }
  25968. throw $e;
  25969. }
  25970. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  25971. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  25972. $this->io->writeError('<info>Token stored successfully.</info>');
  25973. return true;
  25974. }
  25975. public function getRateLimit(array $headers)
  25976. {
  25977. $rateLimit = array(
  25978. 'limit' => '?',
  25979. 'reset' => '?',
  25980. );
  25981. foreach ($headers as $header) {
  25982. $header = trim($header);
  25983. if (false === strpos($header, 'X-RateLimit-')) {
  25984. continue;
  25985. }
  25986. list($type, $value) = explode(':', $header, 2);
  25987. switch ($type) {
  25988. case 'X-RateLimit-Limit':
  25989. $rateLimit['limit'] = (int) trim($value);
  25990. break;
  25991. case 'X-RateLimit-Reset':
  25992. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  25993. break;
  25994. }
  25995. }
  25996. return $rateLimit;
  25997. }
  25998. public function isRateLimited(array $headers)
  25999. {
  26000. foreach ($headers as $header) {
  26001. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  26002. return true;
  26003. }
  26004. }
  26005. return false;
  26006. }
  26007. }
  26008. <?php
  26009. namespace Composer\Util;
  26010. use Composer\IO\IOInterface;
  26011. use Composer\Config;
  26012. use Composer\Factory;
  26013. use Composer\Downloader\TransportException;
  26014. use Composer\Json\JsonFile;
  26015. class GitLab
  26016. {
  26017. protected $io;
  26018. protected $config;
  26019. protected $process;
  26020. protected $remoteFilesystem;
  26021. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26022. {
  26023. $this->io = $io;
  26024. $this->config = $config;
  26025. $this->process = $process ?: new ProcessExecutor($io);
  26026. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26027. }
  26028. public function authorizeOAuth($originUrl)
  26029. {
  26030. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  26031. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  26032. return false;
  26033. }
  26034. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  26035. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  26036. return true;
  26037. }
  26038. $authTokens = $this->config->get('gitlab-token');
  26039. if (isset($authTokens[$originUrl])) {
  26040. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  26041. return true;
  26042. }
  26043. if (isset($authTokens[$bcOriginUrl])) {
  26044. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  26045. return true;
  26046. }
  26047. return false;
  26048. }
  26049. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  26050. {
  26051. if ($message) {
  26052. $this->io->writeError($message);
  26053. }
  26054. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  26055. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  26056. $attemptCounter = 0;
  26057. while ($attemptCounter++ < 5) {
  26058. try {
  26059. $response = $this->createToken($scheme, $originUrl);
  26060. } catch (TransportException $e) {
  26061. if (in_array($e->getCode(), array(403, 401))) {
  26062. if (401 === $e->getCode()) {
  26063. $this->io->writeError('Bad credentials.');
  26064. } else {
  26065. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  26066. }
  26067. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  26068. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  26069. continue;
  26070. }
  26071. throw $e;
  26072. }
  26073. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  26074. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  26075. return true;
  26076. }
  26077. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  26078. }
  26079. private function createToken($scheme, $originUrl)
  26080. {
  26081. $username = $this->io->ask('Username: ');
  26082. $password = $this->io->askAndHideAnswer('Password: ');
  26083. $headers = array('Content-Type: application/x-www-form-urlencoded');
  26084. $apiUrl = $originUrl;
  26085. $data = http_build_query(array(
  26086. 'username' => $username,
  26087. 'password' => $password,
  26088. 'grant_type' => 'password',
  26089. ), null, '&');
  26090. $options = array(
  26091. 'retry-auth-failure' => false,
  26092. 'http' => array(
  26093. 'method' => 'POST',
  26094. 'header' => $headers,
  26095. 'content' => $data,
  26096. ),
  26097. );
  26098. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  26099. $this->io->writeError('Token successfully created');
  26100. return JsonFile::parseJson($json);
  26101. }
  26102. }
  26103. <?php
  26104. namespace Composer\Util;
  26105. use Composer\Config;
  26106. use Composer\IO\IOInterface;
  26107. class Hg
  26108. {
  26109. private $io;
  26110. private $config;
  26111. private $process;
  26112. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  26113. {
  26114. $this->io = $io;
  26115. $this->config = $config;
  26116. $this->process = $process;
  26117. }
  26118. public function runCommand($commandCallable, $url, $cwd)
  26119. {
  26120. $this->config->prohibitUrlByConfig($url, $this->io);
  26121. $command = call_user_func($commandCallable, $url);
  26122. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26123. return;
  26124. }
  26125. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  26126. $auth = $this->io->getAuthentication($match[5]);
  26127. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  26128. $command = call_user_func($commandCallable, $authenticatedUrl);
  26129. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26130. return;
  26131. }
  26132. $error = $this->process->getErrorOutput();
  26133. } else {
  26134. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  26135. }
  26136. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  26137. }
  26138. public static function sanitizeUrl($message)
  26139. {
  26140. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26141. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26142. return '://***:***@';
  26143. }
  26144. return '://' . $m[1] . ':***@';
  26145. }, $message);
  26146. }
  26147. private function throwException($message, $url)
  26148. {
  26149. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  26150. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  26151. }
  26152. throw new \RuntimeException(self::sanitizeUrl($message));
  26153. }
  26154. }
  26155. <?php
  26156. namespace Composer\Util;
  26157. use Composer\XdebugHandler\XdebugHandler;
  26158. class IniHelper
  26159. {
  26160. public static function getAll()
  26161. {
  26162. return XdebugHandler::getAllIniFiles();
  26163. }
  26164. public static function getMessage()
  26165. {
  26166. $paths = self::getAll();
  26167. if (empty($paths[0])) {
  26168. array_shift($paths);
  26169. }
  26170. $ini = array_shift($paths);
  26171. if (empty($ini)) {
  26172. return 'A php.ini file does not exist. You will have to create one.';
  26173. }
  26174. if (!empty($paths)) {
  26175. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  26176. }
  26177. return 'The php.ini used by your command-line PHP is: '.$ini;
  26178. }
  26179. }
  26180. <?php
  26181. namespace Composer\Util;
  26182. class NoProxyPattern
  26183. {
  26184. protected $rules = array();
  26185. public function __construct($pattern)
  26186. {
  26187. $this->rules = preg_split("/[\s,]+/", $pattern);
  26188. }
  26189. public function test($url)
  26190. {
  26191. $host = parse_url($url, PHP_URL_HOST);
  26192. $port = parse_url($url, PHP_URL_PORT);
  26193. if (empty($port)) {
  26194. switch (parse_url($url, PHP_URL_SCHEME)) {
  26195. case 'http':
  26196. $port = 80;
  26197. break;
  26198. case 'https':
  26199. $port = 443;
  26200. break;
  26201. }
  26202. }
  26203. foreach ($this->rules as $rule) {
  26204. if ($rule == '*') {
  26205. return true;
  26206. }
  26207. $match = false;
  26208. list($ruleHost) = explode(':', $rule);
  26209. list($base) = explode('/', $ruleHost);
  26210. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  26211. if (!isset($ip)) {
  26212. $ip = gethostbyname($host);
  26213. }
  26214. if (strpos($ruleHost, '/') === false) {
  26215. $match = $ip === $ruleHost;
  26216. } else {
  26217. if ($ip === $host) {
  26218. $match = false;
  26219. } else {
  26220. $match = self::inCIDRBlock($ruleHost, $ip);
  26221. }
  26222. }
  26223. } else {
  26224. $haystack = '.' . trim($host, '.') . '.';
  26225. $needle = '.'. trim($ruleHost, '.') .'.';
  26226. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  26227. }
  26228. if ($match && strpos($rule, ':') !== false) {
  26229. list(, $rulePort) = explode(':', $rule);
  26230. if (!empty($rulePort) && $port != $rulePort) {
  26231. $match = false;
  26232. }
  26233. }
  26234. if ($match) {
  26235. return true;
  26236. }
  26237. }
  26238. return false;
  26239. }
  26240. private static function inCIDRBlock($cidr, $ip)
  26241. {
  26242. list($base, $bits) = explode('/', $cidr);
  26243. list($a, $b, $c, $d) = explode('.', $base);
  26244. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26245. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  26246. $low = $i & $mask;
  26247. $high = $i | (~$mask & 0xFFFFFFFF);
  26248. list($a, $b, $c, $d) = explode('.', $ip);
  26249. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26250. return $check >= $low && $check <= $high;
  26251. }
  26252. }
  26253. <?php
  26254. namespace Composer\Util;
  26255. use Composer\Package\Link;
  26256. use Composer\Package\PackageInterface;
  26257. class PackageSorter
  26258. {
  26259. public static function sortPackages(array $packages) {
  26260. $usageList = array();
  26261. foreach ($packages as $package) {
  26262. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  26263. $target = $link->getTarget();
  26264. $usageList[$target][] = $package->getName();
  26265. }
  26266. }
  26267. $computing = array();
  26268. $computed = array();
  26269. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  26270. if (isset($computed[$name])) {
  26271. return $computed[$name];
  26272. }
  26273. if (isset($computing[$name])) {
  26274. return 0;
  26275. }
  26276. $computing[$name] = true;
  26277. $weight = 0;
  26278. if (isset($usageList[$name])) {
  26279. foreach ($usageList[$name] as $user) {
  26280. $weight -= 1 - $computeImportance($user);
  26281. }
  26282. }
  26283. unset($computing[$name]);
  26284. $computed[$name] = $weight;
  26285. return $weight;
  26286. };
  26287. $weightList = array();
  26288. foreach ($packages as $name => $package) {
  26289. $weight = $computeImportance($name);
  26290. $weightList[$name] = $weight;
  26291. }
  26292. $stable_sort = function (&$array) {
  26293. static $transform, $restore;
  26294. $i = 0;
  26295. if (!$transform) {
  26296. $transform = function (&$v, $k) use (&$i) {
  26297. $v = array($v, ++$i, $k, $v);
  26298. };
  26299. $restore = function (&$v) {
  26300. $v = $v[3];
  26301. };
  26302. }
  26303. array_walk($array, $transform);
  26304. asort($array);
  26305. array_walk($array, $restore);
  26306. };
  26307. $stable_sort($weightList);
  26308. $sortedPackages = array();
  26309. foreach (array_keys($weightList) as $name) {
  26310. $sortedPackages[] = $packages[$name];
  26311. }
  26312. return $sortedPackages;
  26313. }
  26314. }
  26315. <?php
  26316. namespace Composer\Util;
  26317. use Composer\IO\IOInterface;
  26318. use Symfony\Component\Process\Process;
  26319. class Perforce
  26320. {
  26321. protected $path;
  26322. protected $p4Depot;
  26323. protected $p4Client;
  26324. protected $p4User;
  26325. protected $p4Password;
  26326. protected $p4Port;
  26327. protected $p4Stream;
  26328. protected $p4ClientSpec;
  26329. protected $p4DepotType;
  26330. protected $p4Branch;
  26331. protected $process;
  26332. protected $uniquePerforceClientName;
  26333. protected $windowsFlag;
  26334. protected $commandResult;
  26335. protected $io;
  26336. protected $filesystem;
  26337. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  26338. {
  26339. $this->windowsFlag = $isWindows;
  26340. $this->p4Port = $port;
  26341. $this->initializePath($path);
  26342. $this->process = $process;
  26343. $this->initialize($repoConfig);
  26344. $this->io = $io;
  26345. }
  26346. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  26347. {
  26348. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  26349. }
  26350. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  26351. {
  26352. $output = null;
  26353. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  26354. }
  26355. public function initialize($repoConfig)
  26356. {
  26357. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  26358. if (!$repoConfig) {
  26359. return;
  26360. }
  26361. if (isset($repoConfig['unique_perforce_client_name'])) {
  26362. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  26363. }
  26364. if (isset($repoConfig['depot'])) {
  26365. $this->p4Depot = $repoConfig['depot'];
  26366. }
  26367. if (isset($repoConfig['branch'])) {
  26368. $this->p4Branch = $repoConfig['branch'];
  26369. }
  26370. if (isset($repoConfig['p4user'])) {
  26371. $this->p4User = $repoConfig['p4user'];
  26372. } else {
  26373. $this->p4User = $this->getP4variable('P4USER');
  26374. }
  26375. if (isset($repoConfig['p4password'])) {
  26376. $this->p4Password = $repoConfig['p4password'];
  26377. }
  26378. }
  26379. public function initializeDepotAndBranch($depot, $branch)
  26380. {
  26381. if (isset($depot)) {
  26382. $this->p4Depot = $depot;
  26383. }
  26384. if (isset($branch)) {
  26385. $this->p4Branch = $branch;
  26386. }
  26387. }
  26388. public function generateUniquePerforceClientName()
  26389. {
  26390. return gethostname() . "_" . time();
  26391. }
  26392. public function cleanupClientSpec()
  26393. {
  26394. $client = $this->getClient();
  26395. $task = 'client -d ' . ProcessExecutor::escape($client);
  26396. $useP4Client = false;
  26397. $command = $this->generateP4Command($task, $useP4Client);
  26398. $this->executeCommand($command);
  26399. $clientSpec = $this->getP4ClientSpec();
  26400. $fileSystem = $this->getFilesystem();
  26401. $fileSystem->remove($clientSpec);
  26402. }
  26403. protected function executeCommand($command)
  26404. {
  26405. $this->commandResult = '';
  26406. return $this->process->execute($command, $this->commandResult);
  26407. }
  26408. public function getClient()
  26409. {
  26410. if (!isset($this->p4Client)) {
  26411. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  26412. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  26413. }
  26414. return $this->p4Client;
  26415. }
  26416. protected function getPath()
  26417. {
  26418. return $this->path;
  26419. }
  26420. public function initializePath($path)
  26421. {
  26422. $this->path = $path;
  26423. $fs = $this->getFilesystem();
  26424. $fs->ensureDirectoryExists($path);
  26425. }
  26426. protected function getPort()
  26427. {
  26428. return $this->p4Port;
  26429. }
  26430. public function setStream($stream)
  26431. {
  26432. $this->p4Stream = $stream;
  26433. $index = strrpos($stream, '/');
  26434. if ($index > 2) {
  26435. $this->p4DepotType = 'stream';
  26436. }
  26437. }
  26438. public function isStream()
  26439. {
  26440. return (strcmp($this->p4DepotType, 'stream') === 0);
  26441. }
  26442. public function getStream()
  26443. {
  26444. if (!isset($this->p4Stream)) {
  26445. if ($this->isStream()) {
  26446. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  26447. } else {
  26448. $this->p4Stream = '//' . $this->p4Depot;
  26449. }
  26450. }
  26451. return $this->p4Stream;
  26452. }
  26453. public function getStreamWithoutLabel($stream)
  26454. {
  26455. $index = strpos($stream, '@');
  26456. if ($index === false) {
  26457. return $stream;
  26458. }
  26459. return substr($stream, 0, $index);
  26460. }
  26461. public function getP4ClientSpec()
  26462. {
  26463. return $this->path . '/' . $this->getClient() . '.p4.spec';
  26464. }
  26465. public function getUser()
  26466. {
  26467. return $this->p4User;
  26468. }
  26469. public function setUser($user)
  26470. {
  26471. $this->p4User = $user;
  26472. }
  26473. public function queryP4User()
  26474. {
  26475. $this->getUser();
  26476. if (strlen($this->p4User) > 0) {
  26477. return;
  26478. }
  26479. $this->p4User = $this->getP4variable('P4USER');
  26480. if (strlen($this->p4User) > 0) {
  26481. return;
  26482. }
  26483. $this->p4User = $this->io->ask('Enter P4 User:');
  26484. if ($this->windowsFlag) {
  26485. $command = 'p4 set P4USER=' . $this->p4User;
  26486. } else {
  26487. $command = 'export P4USER=' . $this->p4User;
  26488. }
  26489. $this->executeCommand($command);
  26490. }
  26491. protected function getP4variable($name)
  26492. {
  26493. if ($this->windowsFlag) {
  26494. $command = 'p4 set';
  26495. $this->executeCommand($command);
  26496. $result = trim($this->commandResult);
  26497. $resArray = explode(PHP_EOL, $result);
  26498. foreach ($resArray as $line) {
  26499. $fields = explode('=', $line);
  26500. if (strcmp($name, $fields[0]) == 0) {
  26501. $index = strpos($fields[1], ' ');
  26502. if ($index === false) {
  26503. $value = $fields[1];
  26504. } else {
  26505. $value = substr($fields[1], 0, $index);
  26506. }
  26507. $value = trim($value);
  26508. return $value;
  26509. }
  26510. }
  26511. return null;
  26512. }
  26513. $command = 'echo $' . $name;
  26514. $this->executeCommand($command);
  26515. $result = trim($this->commandResult);
  26516. return $result;
  26517. }
  26518. public function queryP4Password()
  26519. {
  26520. if (isset($this->p4Password)) {
  26521. return $this->p4Password;
  26522. }
  26523. $password = $this->getP4variable('P4PASSWD');
  26524. if (strlen($password) <= 0) {
  26525. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  26526. }
  26527. $this->p4Password = $password;
  26528. return $password;
  26529. }
  26530. public function generateP4Command($command, $useClient = true)
  26531. {
  26532. $p4Command = 'p4 ';
  26533. $p4Command .= '-u ' . $this->getUser() . ' ';
  26534. if ($useClient) {
  26535. $p4Command .= '-c ' . $this->getClient() . ' ';
  26536. }
  26537. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  26538. return $p4Command;
  26539. }
  26540. public function isLoggedIn()
  26541. {
  26542. $command = $this->generateP4Command('login -s', false);
  26543. $exitCode = $this->executeCommand($command);
  26544. if ($exitCode) {
  26545. $errorOutput = $this->process->getErrorOutput();
  26546. $index = strpos($errorOutput, $this->getUser());
  26547. if ($index === false) {
  26548. $index = strpos($errorOutput, 'p4');
  26549. if ($index === false) {
  26550. return false;
  26551. }
  26552. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  26553. }
  26554. throw new \Exception('Invalid user name: ' . $this->getUser());
  26555. }
  26556. return true;
  26557. }
  26558. public function connectClient()
  26559. {
  26560. $p4CreateClientCommand = $this->generateP4Command(
  26561. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  26562. );
  26563. $this->executeCommand($p4CreateClientCommand);
  26564. }
  26565. public function syncCodeBase($sourceReference)
  26566. {
  26567. $prevDir = getcwd();
  26568. chdir($this->path);
  26569. $p4SyncCommand = $this->generateP4Command('sync -f ');
  26570. if (null !== $sourceReference) {
  26571. $p4SyncCommand .= '@' . $sourceReference;
  26572. }
  26573. $this->executeCommand($p4SyncCommand);
  26574. chdir($prevDir);
  26575. }
  26576. public function writeClientSpecToFile($spec)
  26577. {
  26578. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  26579. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  26580. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  26581. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  26582. fwrite($spec, 'Description:' . PHP_EOL);
  26583. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26584. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26585. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26586. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26587. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26588. if ($this->isStream()) {
  26589. fwrite($spec, 'Stream:' . PHP_EOL);
  26590. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26591. } else {
  26592. fwrite(
  26593. $spec,
  26594. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26595. );
  26596. }
  26597. }
  26598. public function writeP4ClientSpec()
  26599. {
  26600. $clientSpec = $this->getP4ClientSpec();
  26601. $spec = fopen($clientSpec, 'w');
  26602. try {
  26603. $this->writeClientSpecToFile($spec);
  26604. } catch (\Exception $e) {
  26605. fclose($spec);
  26606. throw $e;
  26607. }
  26608. fclose($spec);
  26609. }
  26610. protected function read($pipe, $name)
  26611. {
  26612. if (feof($pipe)) {
  26613. return;
  26614. }
  26615. $line = fgets($pipe);
  26616. while ($line !== false) {
  26617. $line = fgets($pipe);
  26618. }
  26619. }
  26620. public function windowsLogin($password)
  26621. {
  26622. $command = $this->generateP4Command(' login -a');
  26623. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26624. $process = Process::fromShellCommandline($command, null, null, $password);
  26625. } else {
  26626. $process = new Process($command, null, null, $password);
  26627. }
  26628. return $process->run();
  26629. }
  26630. public function p4Login()
  26631. {
  26632. $this->queryP4User();
  26633. if (!$this->isLoggedIn()) {
  26634. $password = $this->queryP4Password();
  26635. if ($this->windowsFlag) {
  26636. $this->windowsLogin($password);
  26637. } else {
  26638. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26639. $exitCode = $this->executeCommand($command);
  26640. $result = trim($this->commandResult);
  26641. if ($exitCode) {
  26642. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26643. }
  26644. }
  26645. }
  26646. }
  26647. public function getComposerInformation($identifier)
  26648. {
  26649. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26650. if (!$composerFileContent) {
  26651. return;
  26652. }
  26653. return json_decode($composerFileContent, true);
  26654. }
  26655. public function getFileContent($file, $identifier)
  26656. {
  26657. $path = $this->getFilePath($file, $identifier);
  26658. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26659. $this->executeCommand($command);
  26660. $result = $this->commandResult;
  26661. if (!trim($result)) {
  26662. return null;
  26663. }
  26664. return $result;
  26665. }
  26666. public function getFilePath($file, $identifier)
  26667. {
  26668. $index = strpos($identifier, '@');
  26669. if ($index === false) {
  26670. $path = $identifier. '/' . $file;
  26671. return $path;
  26672. }
  26673. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26674. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26675. $this->executeCommand($command);
  26676. $result = $this->commandResult;
  26677. $index2 = strpos($result, 'no such file(s).');
  26678. if ($index2 === false) {
  26679. $index3 = strpos($result, 'change');
  26680. if ($index3 !== false) {
  26681. $phrase = trim(substr($result, $index3));
  26682. $fields = explode(' ', $phrase);
  26683. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26684. }
  26685. }
  26686. return null;
  26687. }
  26688. public function getBranches()
  26689. {
  26690. $possibleBranches = array();
  26691. if (!$this->isStream()) {
  26692. $possibleBranches[$this->p4Branch] = $this->getStream();
  26693. } else {
  26694. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26695. $this->executeCommand($command);
  26696. $result = $this->commandResult;
  26697. $resArray = explode(PHP_EOL, $result);
  26698. foreach ($resArray as $line) {
  26699. $resBits = explode(' ', $line);
  26700. if (count($resBits) > 4) {
  26701. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26702. $possibleBranches[$branch] = $resBits[1];
  26703. }
  26704. }
  26705. }
  26706. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26707. $this->executeCommand($command);
  26708. $result = $this->commandResult;
  26709. $resArray = explode(PHP_EOL, $result);
  26710. $lastCommit = $resArray[0];
  26711. $lastCommitArr = explode(' ', $lastCommit);
  26712. $lastCommitNum = $lastCommitArr[1];
  26713. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26714. return $branches;
  26715. }
  26716. public function getTags()
  26717. {
  26718. $command = $this->generateP4Command('labels');
  26719. $this->executeCommand($command);
  26720. $result = $this->commandResult;
  26721. $resArray = explode(PHP_EOL, $result);
  26722. $tags = array();
  26723. foreach ($resArray as $line) {
  26724. if (strpos($line, 'Label') !== false) {
  26725. $fields = explode(' ', $line);
  26726. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26727. }
  26728. }
  26729. return $tags;
  26730. }
  26731. public function checkStream()
  26732. {
  26733. $command = $this->generateP4Command('depots', false);
  26734. $this->executeCommand($command);
  26735. $result = $this->commandResult;
  26736. $resArray = explode(PHP_EOL, $result);
  26737. foreach ($resArray as $line) {
  26738. if (strpos($line, 'Depot') !== false) {
  26739. $fields = explode(' ', $line);
  26740. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26741. $this->p4DepotType = $fields[3];
  26742. return $this->isStream();
  26743. }
  26744. }
  26745. }
  26746. return false;
  26747. }
  26748. protected function getChangeList($reference)
  26749. {
  26750. $index = strpos($reference, '@');
  26751. if ($index === false) {
  26752. return null;
  26753. }
  26754. $label = substr($reference, $index);
  26755. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26756. $this->executeCommand($command);
  26757. $changes = $this->commandResult;
  26758. if (strpos($changes, 'Change') !== 0) {
  26759. return null;
  26760. }
  26761. $fields = explode(' ', $changes);
  26762. return $fields[1];
  26763. }
  26764. public function getCommitLogs($fromReference, $toReference)
  26765. {
  26766. $fromChangeList = $this->getChangeList($fromReference);
  26767. if ($fromChangeList === null) {
  26768. return null;
  26769. }
  26770. $toChangeList = $this->getChangeList($toReference);
  26771. if ($toChangeList === null) {
  26772. return null;
  26773. }
  26774. $index = strpos($fromReference, '@');
  26775. $main = substr($fromReference, 0, $index) . '/...';
  26776. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26777. $this->executeCommand($command);
  26778. return $this->commandResult;
  26779. }
  26780. public function getFilesystem()
  26781. {
  26782. if (empty($this->filesystem)) {
  26783. $this->filesystem = new Filesystem($this->process);
  26784. }
  26785. return $this->filesystem;
  26786. }
  26787. public function setFilesystem(Filesystem $fs)
  26788. {
  26789. $this->filesystem = $fs;
  26790. }
  26791. }
  26792. <?php
  26793. namespace Composer\Util;
  26794. class Platform
  26795. {
  26796. public static function expandPath($path)
  26797. {
  26798. if (preg_match('#^~[\\/]#', $path)) {
  26799. return self::getUserDirectory() . substr($path, 1);
  26800. }
  26801. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26802. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26803. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26804. }
  26805. return getenv($matches['var']) . $matches['path'];
  26806. }, $path);
  26807. }
  26808. public static function getUserDirectory()
  26809. {
  26810. if (false !== ($home = getenv('HOME'))) {
  26811. return $home;
  26812. }
  26813. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26814. return $home;
  26815. }
  26816. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26817. $info = posix_getpwuid(posix_getuid());
  26818. return $info['dir'];
  26819. }
  26820. throw new \RuntimeException('Could not determine user directory');
  26821. }
  26822. public static function isWindows()
  26823. {
  26824. return defined('PHP_WINDOWS_VERSION_BUILD');
  26825. }
  26826. public static function strlen($str)
  26827. {
  26828. static $useMbString = null;
  26829. if (null === $useMbString) {
  26830. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26831. }
  26832. if ($useMbString) {
  26833. return mb_strlen($str, '8bit');
  26834. }
  26835. return strlen($str);
  26836. }
  26837. }
  26838. <?php
  26839. namespace Composer\Util;
  26840. use Composer\IO\IOInterface;
  26841. use Symfony\Component\Process\Process;
  26842. use Symfony\Component\Process\ProcessUtils;
  26843. class ProcessExecutor
  26844. {
  26845. protected static $timeout = 300;
  26846. protected $captureOutput;
  26847. protected $errorOutput;
  26848. protected $io;
  26849. public function __construct(IOInterface $io = null)
  26850. {
  26851. $this->io = $io;
  26852. }
  26853. public function execute($command, &$output = null, $cwd = null)
  26854. {
  26855. if ($this->io && $this->io->isDebug()) {
  26856. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26857. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26858. return '://***:***@';
  26859. }
  26860. return '://'.$m['user'].':***@';
  26861. }, $command);
  26862. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  26863. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26864. }
  26865. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26866. $cwd = realpath(getcwd());
  26867. }
  26868. $this->captureOutput = func_num_args() > 1;
  26869. $this->errorOutput = null;
  26870. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26871. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  26872. } else {
  26873. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26874. }
  26875. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26876. $process->run($callback);
  26877. if ($this->captureOutput && !is_callable($output)) {
  26878. $output = $process->getOutput();
  26879. }
  26880. $this->errorOutput = $process->getErrorOutput();
  26881. return $process->getExitCode();
  26882. }
  26883. public function splitLines($output)
  26884. {
  26885. $output = trim($output);
  26886. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26887. }
  26888. public function getErrorOutput()
  26889. {
  26890. return $this->errorOutput;
  26891. }
  26892. public function outputHandler($type, $buffer)
  26893. {
  26894. if ($this->captureOutput) {
  26895. return;
  26896. }
  26897. if (null === $this->io) {
  26898. echo $buffer;
  26899. return;
  26900. }
  26901. if (Process::ERR === $type) {
  26902. $this->io->writeError($buffer, false);
  26903. } else {
  26904. $this->io->write($buffer, false);
  26905. }
  26906. }
  26907. public static function getTimeout()
  26908. {
  26909. return static::$timeout;
  26910. }
  26911. public static function setTimeout($timeout)
  26912. {
  26913. static::$timeout = $timeout;
  26914. }
  26915. public static function escape($argument)
  26916. {
  26917. return self::escapeArgument($argument);
  26918. }
  26919. private static function escapeArgument($argument)
  26920. {
  26921. if ('\\' === DIRECTORY_SEPARATOR) {
  26922. if ('' === $argument) {
  26923. return escapeshellarg($argument);
  26924. }
  26925. $escapedArgument = '';
  26926. $quote = false;
  26927. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  26928. if ('"' === $part) {
  26929. $escapedArgument .= '\\"';
  26930. } elseif (self::isSurroundedBy($part, '%')) {
  26931. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  26932. } else {
  26933. if ('\\' === substr($part, -1)) {
  26934. $part .= '\\';
  26935. }
  26936. $quote = true;
  26937. $escapedArgument .= $part;
  26938. }
  26939. }
  26940. if ($quote) {
  26941. $escapedArgument = '"'.$escapedArgument.'"';
  26942. }
  26943. return $escapedArgument;
  26944. }
  26945. return "'".str_replace("'", "'\\''", $argument)."'";
  26946. }
  26947. private static function isSurroundedBy($arg, $char)
  26948. {
  26949. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  26950. }
  26951. }
  26952. <?php
  26953. namespace Composer\Util;
  26954. use Composer\Config;
  26955. use Composer\Composer;
  26956. use Composer\Semver\Constraint\Constraint;
  26957. use Composer\Package\Version\VersionParser;
  26958. use Composer\IO\IOInterface;
  26959. use Composer\Downloader\TransportException;
  26960. use Composer\CaBundle\CaBundle;
  26961. use Psr\Log\LoggerInterface;
  26962. class RemoteFilesystem
  26963. {
  26964. private $io;
  26965. private $config;
  26966. private $scheme;
  26967. private $bytesMax;
  26968. private $originUrl;
  26969. private $fileUrl;
  26970. private $fileName;
  26971. private $retry;
  26972. private $progress;
  26973. private $lastProgress;
  26974. private $options = array();
  26975. private $peerCertificateMap = array();
  26976. private $disableTls = false;
  26977. private $retryAuthFailure;
  26978. private $lastHeaders;
  26979. private $storeAuth;
  26980. private $degradedMode = false;
  26981. private $redirects;
  26982. private $maxRedirects = 20;
  26983. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  26984. {
  26985. $this->io = $io;
  26986. if ($disableTls === false) {
  26987. $this->options = $this->getTlsDefaults($options);
  26988. } else {
  26989. $this->disableTls = true;
  26990. }
  26991. $this->options = array_replace_recursive($this->options, $options);
  26992. $this->config = $config;
  26993. }
  26994. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  26995. {
  26996. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  26997. }
  26998. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  26999. {
  27000. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  27001. }
  27002. public function getOptions()
  27003. {
  27004. return $this->options;
  27005. }
  27006. public function setOptions(array $options)
  27007. {
  27008. $this->options = array_replace_recursive($this->options, $options);
  27009. }
  27010. public function isTlsDisabled()
  27011. {
  27012. return $this->disableTls === true;
  27013. }
  27014. public function getLastHeaders()
  27015. {
  27016. return $this->lastHeaders;
  27017. }
  27018. public function findHeaderValue(array $headers, $name)
  27019. {
  27020. $value = null;
  27021. foreach ($headers as $header) {
  27022. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  27023. $value = $match[1];
  27024. } elseif (preg_match('{^HTTP/}i', $header)) {
  27025. $value = null;
  27026. }
  27027. }
  27028. return $value;
  27029. }
  27030. public function findStatusCode(array $headers)
  27031. {
  27032. $value = null;
  27033. foreach ($headers as $header) {
  27034. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  27035. $value = (int) $match[1];
  27036. }
  27037. }
  27038. return $value;
  27039. }
  27040. public function findStatusMessage(array $headers)
  27041. {
  27042. $value = null;
  27043. foreach ($headers as $header) {
  27044. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  27045. $value = $header;
  27046. }
  27047. }
  27048. return $value;
  27049. }
  27050. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  27051. {
  27052. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  27053. $originUrl = 'github.com';
  27054. }
  27055. if (
  27056. $this->config
  27057. && is_array($this->config->get('gitlab-domains'))
  27058. && false === strpos($originUrl, '/')
  27059. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  27060. ) {
  27061. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  27062. if (0 === strpos($gitlabDomain, $originUrl)) {
  27063. $originUrl = $gitlabDomain;
  27064. break;
  27065. }
  27066. }
  27067. unset($gitlabDomain);
  27068. }
  27069. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  27070. $this->bytesMax = 0;
  27071. $this->originUrl = $originUrl;
  27072. $this->fileUrl = $fileUrl;
  27073. $this->fileName = $fileName;
  27074. $this->progress = $progress;
  27075. $this->lastProgress = null;
  27076. $this->retryAuthFailure = true;
  27077. $this->lastHeaders = array();
  27078. $this->redirects = 1;
  27079. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  27080. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  27081. }
  27082. $tempAdditionalOptions = $additionalOptions;
  27083. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  27084. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  27085. unset($tempAdditionalOptions['retry-auth-failure']);
  27086. }
  27087. $isRedirect = false;
  27088. if (isset($tempAdditionalOptions['redirects'])) {
  27089. $this->redirects = $tempAdditionalOptions['redirects'];
  27090. $isRedirect = true;
  27091. unset($tempAdditionalOptions['redirects']);
  27092. }
  27093. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  27094. unset($tempAdditionalOptions);
  27095. $origFileUrl = $fileUrl;
  27096. if (isset($options['github-token'])) {
  27097. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  27098. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  27099. }
  27100. unset($options['github-token']);
  27101. }
  27102. if (isset($options['gitlab-token'])) {
  27103. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  27104. unset($options['gitlab-token']);
  27105. }
  27106. if (isset($options['http'])) {
  27107. $options['http']['ignore_errors'] = true;
  27108. }
  27109. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  27110. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  27111. $degradedPackagist = true;
  27112. }
  27113. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  27114. $actualContextOptions = stream_context_get_options($ctx);
  27115. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  27116. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  27117. unset($origFileUrl, $actualContextOptions);
  27118. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  27119. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  27120. }
  27121. if ($this->progress && !$isRedirect) {
  27122. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  27123. }
  27124. $errorMessage = '';
  27125. $errorCode = 0;
  27126. $result = false;
  27127. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27128. if ($errorMessage) {
  27129. $errorMessage .= "\n";
  27130. }
  27131. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  27132. return true;
  27133. });
  27134. try {
  27135. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  27136. if (!empty($http_response_header[0])) {
  27137. $statusCode = $this->findStatusCode($http_response_header);
  27138. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  27139. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  27140. }
  27141. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  27142. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  27143. }
  27144. }
  27145. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  27146. if ($contentLength && Platform::strlen($result) < $contentLength) {
  27147. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  27148. $e->setHeaders($http_response_header);
  27149. $e->setStatusCode($this->findStatusCode($http_response_header));
  27150. $e->setResponse($result);
  27151. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  27152. throw $e;
  27153. }
  27154. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  27155. $params = stream_context_get_params($ctx);
  27156. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  27157. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  27158. if ($expectedPeerFingerprint !== $peerFingerprint) {
  27159. throw new TransportException('Peer fingerprint did not match');
  27160. }
  27161. }
  27162. } catch (\Exception $e) {
  27163. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  27164. $e->setHeaders($http_response_header);
  27165. $e->setStatusCode($this->findStatusCode($http_response_header));
  27166. }
  27167. if ($e instanceof TransportException && $result !== false) {
  27168. $e->setResponse($result);
  27169. }
  27170. $result = false;
  27171. }
  27172. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  27173. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  27174. }
  27175. restore_error_handler();
  27176. if (isset($e) && !$this->retry) {
  27177. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27178. $this->degradedMode = true;
  27179. $this->io->writeError('');
  27180. $this->io->writeError(array(
  27181. '<error>'.$e->getMessage().'</error>',
  27182. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27183. ));
  27184. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27185. }
  27186. throw $e;
  27187. }
  27188. $statusCode = null;
  27189. $contentType = null;
  27190. $locationHeader = null;
  27191. if (!empty($http_response_header[0])) {
  27192. $statusCode = $this->findStatusCode($http_response_header);
  27193. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  27194. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  27195. }
  27196. if ($originUrl === 'bitbucket.org'
  27197. && !$this->isPublicBitBucketDownload($fileUrl)
  27198. && substr($fileUrl, -4) === '.zip'
  27199. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  27200. && $contentType && preg_match('{^text/html\b}i', $contentType)
  27201. ) {
  27202. $result = false;
  27203. if ($this->retryAuthFailure) {
  27204. $this->promptAuthAndRetry(401);
  27205. }
  27206. }
  27207. if ($statusCode === 404
  27208. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  27209. && false !== strpos($fileUrl, 'archive.zip')
  27210. ) {
  27211. $result = false;
  27212. if ($this->retryAuthFailure) {
  27213. $this->promptAuthAndRetry(401);
  27214. }
  27215. }
  27216. $hasFollowedRedirect = false;
  27217. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  27218. $hasFollowedRedirect = true;
  27219. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  27220. }
  27221. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  27222. if (!$this->retry) {
  27223. if ($this->progress && !$this->retry && !$isRedirect) {
  27224. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  27225. }
  27226. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  27227. $e->setHeaders($http_response_header);
  27228. $e->setResponse($result);
  27229. $e->setStatusCode($statusCode);
  27230. throw $e;
  27231. }
  27232. $result = false;
  27233. }
  27234. if ($this->progress && !$this->retry && !$isRedirect) {
  27235. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  27236. }
  27237. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  27238. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  27239. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  27240. if ($decode) {
  27241. try {
  27242. if (PHP_VERSION_ID >= 50400) {
  27243. $result = zlib_decode($result);
  27244. } else {
  27245. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  27246. }
  27247. if (!$result) {
  27248. throw new TransportException('Failed to decode zlib stream');
  27249. }
  27250. } catch (\Exception $e) {
  27251. if ($this->degradedMode) {
  27252. throw $e;
  27253. }
  27254. $this->degradedMode = true;
  27255. $this->io->writeError(array(
  27256. '',
  27257. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  27258. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27259. ));
  27260. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27261. }
  27262. }
  27263. }
  27264. if (false !== $result && null !== $fileName && !$isRedirect) {
  27265. if ('' === $result) {
  27266. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  27267. }
  27268. $errorMessage = '';
  27269. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27270. if ($errorMessage) {
  27271. $errorMessage .= "\n";
  27272. }
  27273. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  27274. return true;
  27275. });
  27276. $result = (bool) file_put_contents($fileName, $result);
  27277. restore_error_handler();
  27278. if (false === $result) {
  27279. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  27280. }
  27281. }
  27282. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  27283. if (CaBundle::isOpensslParseSafe()) {
  27284. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  27285. if ($certDetails) {
  27286. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  27287. $this->retry = true;
  27288. }
  27289. } else {
  27290. $this->io->writeError('');
  27291. $this->io->writeError(sprintf(
  27292. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  27293. PHP_VERSION
  27294. ));
  27295. }
  27296. }
  27297. if ($this->retry) {
  27298. $this->retry = false;
  27299. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27300. if ($this->storeAuth && $this->config) {
  27301. $authHelper = new AuthHelper($this->io, $this->config);
  27302. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  27303. $this->storeAuth = false;
  27304. }
  27305. return $result;
  27306. }
  27307. if (false === $result) {
  27308. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  27309. if (!empty($http_response_header[0])) {
  27310. $e->setHeaders($http_response_header);
  27311. }
  27312. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27313. $this->degradedMode = true;
  27314. $this->io->writeError('');
  27315. $this->io->writeError(array(
  27316. '<error>'.$e->getMessage().'</error>',
  27317. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27318. ));
  27319. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27320. }
  27321. throw $e;
  27322. }
  27323. if (!empty($http_response_header[0])) {
  27324. $this->lastHeaders = $http_response_header;
  27325. }
  27326. return $result;
  27327. }
  27328. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  27329. {
  27330. try {
  27331. $e = null;
  27332. $result = file_get_contents($fileUrl, false, $context);
  27333. } catch (\Throwable $e) {
  27334. } catch (\Exception $e) {
  27335. }
  27336. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  27337. if (null !== $e) {
  27338. throw $e;
  27339. }
  27340. return $result;
  27341. }
  27342. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  27343. {
  27344. switch ($notificationCode) {
  27345. case STREAM_NOTIFY_FAILURE:
  27346. if (400 === $messageCode) {
  27347. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  27348. }
  27349. break;
  27350. case STREAM_NOTIFY_FILE_SIZE_IS:
  27351. $this->bytesMax = $bytesMax;
  27352. break;
  27353. case STREAM_NOTIFY_PROGRESS:
  27354. if ($this->bytesMax > 0 && $this->progress) {
  27355. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  27356. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  27357. $this->lastProgress = $progression;
  27358. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  27359. }
  27360. }
  27361. break;
  27362. default:
  27363. break;
  27364. }
  27365. }
  27366. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  27367. {
  27368. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  27369. $gitHubUtil = new GitHub($this->io, $this->config, null);
  27370. $message = "\n";
  27371. $rateLimited = $gitHubUtil->isRateLimited($headers);
  27372. if ($rateLimited) {
  27373. $rateLimit = $gitHubUtil->getRateLimit($headers);
  27374. if ($this->io->hasAuthentication($this->originUrl)) {
  27375. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  27376. } else {
  27377. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  27378. }
  27379. $message = sprintf(
  27380. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  27381. $rateLimit['limit'],
  27382. $rateLimit['reset']
  27383. )."\n";
  27384. } else {
  27385. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  27386. if ($this->io->hasAuthentication($this->originUrl)) {
  27387. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  27388. } else {
  27389. $message .= 'create a GitHub OAuth token to access private repos';
  27390. }
  27391. }
  27392. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  27393. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27394. ) {
  27395. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27396. }
  27397. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  27398. $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');
  27399. $gitLabUtil = new GitLab($this->io, $this->config, null);
  27400. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  27401. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27402. }
  27403. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  27404. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  27405. ) {
  27406. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27407. }
  27408. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  27409. $askForOAuthToken = true;
  27410. if ($this->io->hasAuthentication($this->originUrl)) {
  27411. $auth = $this->io->getAuthentication($this->originUrl);
  27412. if ($auth['username'] !== 'x-token-auth') {
  27413. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  27414. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  27415. if (!empty($accessToken)) {
  27416. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  27417. $askForOAuthToken = false;
  27418. }
  27419. } else {
  27420. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27421. }
  27422. }
  27423. if ($askForOAuthToken) {
  27424. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  27425. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  27426. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  27427. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27428. ) {
  27429. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27430. }
  27431. }
  27432. } else {
  27433. if ($httpStatus === 404) {
  27434. return;
  27435. }
  27436. if (!$this->io->isInteractive()) {
  27437. if ($httpStatus === 401) {
  27438. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  27439. }
  27440. if ($httpStatus === 403) {
  27441. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  27442. }
  27443. throw new TransportException($message, $httpStatus);
  27444. }
  27445. if ($this->io->hasAuthentication($this->originUrl)) {
  27446. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27447. }
  27448. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  27449. $username = $this->io->ask(' Username: ');
  27450. $password = $this->io->askAndHideAnswer(' Password: ');
  27451. $this->io->setAuthentication($this->originUrl, $username, $password);
  27452. $this->storeAuth = $this->config->get('store-auths');
  27453. }
  27454. $this->retry = true;
  27455. throw new TransportException('RETRY');
  27456. }
  27457. protected function getOptionsForUrl($originUrl, $additionalOptions)
  27458. {
  27459. $tlsOptions = array();
  27460. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  27461. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  27462. if (PHP_VERSION_ID < 50304) {
  27463. if ($host === 'github.com' || $host === 'api.github.com') {
  27464. $host = '*.github.com';
  27465. }
  27466. }
  27467. $tlsOptions['ssl']['CN_match'] = $host;
  27468. $tlsOptions['ssl']['SNI_server_name'] = $host;
  27469. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  27470. if (isset($this->peerCertificateMap[$urlAuthority])) {
  27471. $certMap = $this->peerCertificateMap[$urlAuthority];
  27472. $this->io->writeError('', true, IOInterface::DEBUG);
  27473. $this->io->writeError(sprintf(
  27474. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  27475. $certMap['cn'],
  27476. $urlAuthority
  27477. ), true, IOInterface::DEBUG);
  27478. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  27479. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  27480. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  27481. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  27482. }
  27483. }
  27484. $headers = array();
  27485. if (extension_loaded('zlib')) {
  27486. $headers[] = 'Accept-Encoding: gzip';
  27487. }
  27488. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  27489. if (!$this->degradedMode) {
  27490. $options['http']['protocol_version'] = 1.1;
  27491. $headers[] = 'Connection: close';
  27492. }
  27493. if ($this->io->hasAuthentication($originUrl)) {
  27494. $auth = $this->io->getAuthentication($originUrl);
  27495. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  27496. $options['github-token'] = $auth['username'];
  27497. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  27498. if ($auth['password'] === 'oauth2') {
  27499. $headers[] = 'Authorization: Bearer '.$auth['username'];
  27500. } elseif ($auth['password'] === 'private-token') {
  27501. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  27502. }
  27503. } elseif ('bitbucket.org' === $originUrl
  27504. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  27505. ) {
  27506. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  27507. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  27508. }
  27509. } else {
  27510. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  27511. $headers[] = 'Authorization: Basic '.$authStr;
  27512. }
  27513. }
  27514. $options['http']['follow_location'] = 0;
  27515. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  27516. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  27517. }
  27518. foreach ($headers as $header) {
  27519. $options['http']['header'][] = $header;
  27520. }
  27521. return $options;
  27522. }
  27523. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  27524. {
  27525. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  27526. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  27527. $targetUrl = $locationHeader;
  27528. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  27529. $targetUrl = $this->scheme.':'.$locationHeader;
  27530. } elseif ('/' === $locationHeader[0]) {
  27531. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  27532. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27533. } else {
  27534. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27535. }
  27536. }
  27537. if (!empty($targetUrl)) {
  27538. $this->redirects++;
  27539. $this->io->writeError('', true, IOInterface::DEBUG);
  27540. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  27541. $additionalOptions['redirects'] = $this->redirects;
  27542. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  27543. }
  27544. if (!$this->retry) {
  27545. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  27546. $e->setHeaders($http_response_header);
  27547. $e->setResponse($result);
  27548. throw $e;
  27549. }
  27550. return false;
  27551. }
  27552. private function getTlsDefaults(array $options)
  27553. {
  27554. $ciphers = implode(':', array(
  27555. 'ECDHE-RSA-AES128-GCM-SHA256',
  27556. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  27557. 'ECDHE-RSA-AES256-GCM-SHA384',
  27558. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  27559. 'DHE-RSA-AES128-GCM-SHA256',
  27560. 'DHE-DSS-AES128-GCM-SHA256',
  27561. 'kEDH+AESGCM',
  27562. 'ECDHE-RSA-AES128-SHA256',
  27563. 'ECDHE-ECDSA-AES128-SHA256',
  27564. 'ECDHE-RSA-AES128-SHA',
  27565. 'ECDHE-ECDSA-AES128-SHA',
  27566. 'ECDHE-RSA-AES256-SHA384',
  27567. 'ECDHE-ECDSA-AES256-SHA384',
  27568. 'ECDHE-RSA-AES256-SHA',
  27569. 'ECDHE-ECDSA-AES256-SHA',
  27570. 'DHE-RSA-AES128-SHA256',
  27571. 'DHE-RSA-AES128-SHA',
  27572. 'DHE-DSS-AES128-SHA256',
  27573. 'DHE-RSA-AES256-SHA256',
  27574. 'DHE-DSS-AES256-SHA',
  27575. 'DHE-RSA-AES256-SHA',
  27576. 'AES128-GCM-SHA256',
  27577. 'AES256-GCM-SHA384',
  27578. 'AES128-SHA256',
  27579. 'AES256-SHA256',
  27580. 'AES128-SHA',
  27581. 'AES256-SHA',
  27582. 'AES',
  27583. 'CAMELLIA',
  27584. 'DES-CBC3-SHA',
  27585. '!aNULL',
  27586. '!eNULL',
  27587. '!EXPORT',
  27588. '!DES',
  27589. '!RC4',
  27590. '!MD5',
  27591. '!PSK',
  27592. '!aECDH',
  27593. '!EDH-DSS-DES-CBC3-SHA',
  27594. '!EDH-RSA-DES-CBC3-SHA',
  27595. '!KRB5-DES-CBC3-SHA',
  27596. ));
  27597. $defaults = array(
  27598. 'ssl' => array(
  27599. 'ciphers' => $ciphers,
  27600. 'verify_peer' => true,
  27601. 'verify_depth' => 7,
  27602. 'SNI_enabled' => true,
  27603. 'capture_peer_cert' => true,
  27604. ),
  27605. );
  27606. if (isset($options['ssl'])) {
  27607. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27608. }
  27609. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27610. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27611. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27612. if (is_dir($result)) {
  27613. $defaults['ssl']['capath'] = $result;
  27614. } else {
  27615. $defaults['ssl']['cafile'] = $result;
  27616. }
  27617. }
  27618. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27619. throw new TransportException('The configured cafile was not valid or could not be read.');
  27620. }
  27621. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27622. throw new TransportException('The configured capath was not valid or could not be read.');
  27623. }
  27624. if (PHP_VERSION_ID >= 50413) {
  27625. $defaults['ssl']['disable_compression'] = true;
  27626. }
  27627. return $defaults;
  27628. }
  27629. private function getCertificateCnAndFp($url, $options)
  27630. {
  27631. if (PHP_VERSION_ID >= 50600) {
  27632. throw new \BadMethodCallException(sprintf(
  27633. '%s must not be used on PHP >= 5.6',
  27634. __METHOD__
  27635. ));
  27636. }
  27637. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27638. 'ssl' => array(
  27639. 'capture_peer_cert' => true,
  27640. 'verify_peer' => false,
  27641. ), ),
  27642. ));
  27643. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27644. return;
  27645. }
  27646. fclose($handle);
  27647. $handle = null;
  27648. $params = stream_context_get_params($context);
  27649. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27650. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27651. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27652. return array(
  27653. 'cn' => $commonName,
  27654. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27655. );
  27656. }
  27657. }
  27658. }
  27659. private function getUrlAuthority($url)
  27660. {
  27661. $defaultPorts = array(
  27662. 'ftp' => 21,
  27663. 'http' => 80,
  27664. 'https' => 443,
  27665. 'ssh2.sftp' => 22,
  27666. 'ssh2.scp' => 22,
  27667. );
  27668. $scheme = parse_url($url, PHP_URL_SCHEME);
  27669. if (!isset($defaultPorts[$scheme])) {
  27670. throw new \InvalidArgumentException(sprintf(
  27671. 'Could not get default port for unknown scheme: %s',
  27672. $scheme
  27673. ));
  27674. }
  27675. $defaultPort = $defaultPorts[$scheme];
  27676. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27677. return parse_url($url, PHP_URL_HOST).':'.$port;
  27678. }
  27679. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27680. {
  27681. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27682. if (strpos($domain, 'bitbucket.org') === false) {
  27683. return true;
  27684. }
  27685. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27686. $pathParts = explode('/', $path);
  27687. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27688. }
  27689. public static function outputWarnings(IOInterface $io, $url, $data)
  27690. {
  27691. foreach (array('warning', 'info') as $type) {
  27692. if (empty($data[$type])) {
  27693. continue;
  27694. }
  27695. if (!empty($data[$type . '-versions'])) {
  27696. $versionParser = new VersionParser();
  27697. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  27698. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  27699. if (!$constraint->matches($composer)) {
  27700. continue;
  27701. }
  27702. }
  27703. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  27704. }
  27705. }
  27706. public static function getOrigin($urlOrPath)
  27707. {
  27708. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  27709. if (!$hostPort) {
  27710. return $urlOrPath;
  27711. }
  27712. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  27713. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  27714. }
  27715. return $hostPort;
  27716. }
  27717. }
  27718. <?php
  27719. namespace Composer\Util;
  27720. class Silencer
  27721. {
  27722. private static $stack = array();
  27723. public static function suppress($mask = null)
  27724. {
  27725. if (!isset($mask)) {
  27726. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27727. }
  27728. $old = error_reporting();
  27729. self::$stack[] = $old;
  27730. error_reporting($old & ~$mask);
  27731. return $old;
  27732. }
  27733. public static function restore()
  27734. {
  27735. if (!empty(self::$stack)) {
  27736. error_reporting(array_pop(self::$stack));
  27737. }
  27738. }
  27739. public static function call($callable )
  27740. {
  27741. try {
  27742. self::suppress();
  27743. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27744. self::restore();
  27745. return $result;
  27746. } catch (\Exception $e) {
  27747. self::restore();
  27748. throw $e;
  27749. }
  27750. }
  27751. }
  27752. <?php
  27753. namespace Composer\Util;
  27754. use Composer\Spdx\SpdxLicenses;
  27755. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27756. class SpdxLicense extends SpdxLicenses
  27757. {
  27758. }
  27759. <?php
  27760. namespace Composer\Util;
  27761. use Composer\Composer;
  27762. final class StreamContextFactory
  27763. {
  27764. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27765. {
  27766. $options = array('http' => array(
  27767. 'follow_location' => 1,
  27768. 'max_redirects' => 20,
  27769. ));
  27770. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27771. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27772. }
  27773. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27774. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27775. }
  27776. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27777. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27778. }
  27779. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27780. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27781. if ($pattern->test($url)) {
  27782. unset($proxy);
  27783. }
  27784. }
  27785. if (!empty($proxy)) {
  27786. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27787. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27788. if (isset($proxy['port'])) {
  27789. $proxyURL .= ":" . $proxy['port'];
  27790. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27791. $proxyURL .= ":80";
  27792. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27793. $proxyURL .= ":443";
  27794. }
  27795. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27796. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27797. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27798. }
  27799. $options['http']['proxy'] = $proxyURL;
  27800. switch (parse_url($url, PHP_URL_SCHEME)) {
  27801. case 'http':
  27802. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27803. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27804. $options['http']['request_fulluri'] = true;
  27805. }
  27806. break;
  27807. case 'https':
  27808. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27809. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27810. $options['http']['request_fulluri'] = true;
  27811. }
  27812. break;
  27813. }
  27814. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27815. $options['ssl']['SNI_enabled'] = true;
  27816. if (PHP_VERSION_ID < 50600) {
  27817. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27818. }
  27819. }
  27820. if (isset($proxy['user'])) {
  27821. $auth = rawurldecode($proxy['user']);
  27822. if (isset($proxy['pass'])) {
  27823. $auth .= ':' . rawurldecode($proxy['pass']);
  27824. }
  27825. $auth = base64_encode($auth);
  27826. if (isset($defaultOptions['http']['header'])) {
  27827. if (is_string($defaultOptions['http']['header'])) {
  27828. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27829. }
  27830. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27831. } else {
  27832. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27833. }
  27834. }
  27835. }
  27836. $options = array_replace_recursive($options, $defaultOptions);
  27837. if (isset($options['http']['header'])) {
  27838. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27839. }
  27840. if (defined('HHVM_VERSION')) {
  27841. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27842. } else {
  27843. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27844. }
  27845. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27846. $options['http']['header'][] = sprintf(
  27847. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27848. Composer::getVersion(),
  27849. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27850. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27851. $phpVersion,
  27852. getenv('CI') ? '; CI' : ''
  27853. );
  27854. }
  27855. return stream_context_create($options, $defaultParams);
  27856. }
  27857. private static function fixHttpHeaderField($header)
  27858. {
  27859. if (!is_array($header)) {
  27860. $header = explode("\r\n", $header);
  27861. }
  27862. uasort($header, function ($el) {
  27863. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27864. });
  27865. return $header;
  27866. }
  27867. }
  27868. <?php
  27869. namespace Composer\Util;
  27870. use Composer\Config;
  27871. use Composer\IO\IOInterface;
  27872. class Svn
  27873. {
  27874. const MAX_QTY_AUTH_TRIES = 5;
  27875. protected $credentials;
  27876. protected $hasAuth;
  27877. protected $io;
  27878. protected $url;
  27879. protected $cacheCredentials = true;
  27880. protected $process;
  27881. protected $qtyAuthTries = 0;
  27882. protected $config;
  27883. private static $version;
  27884. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27885. {
  27886. $this->url = $url;
  27887. $this->io = $io;
  27888. $this->config = $config;
  27889. $this->process = $process ?: new ProcessExecutor($io);
  27890. }
  27891. public static function cleanEnv()
  27892. {
  27893. putenv("DYLD_LIBRARY_PATH");
  27894. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27895. }
  27896. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27897. {
  27898. $this->config->prohibitUrlByConfig($url, $this->io);
  27899. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27900. }
  27901. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27902. {
  27903. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27904. }
  27905. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27906. {
  27907. $command = $this->getCommand($svnCommand, $url, $path);
  27908. $output = null;
  27909. $io = $this->io;
  27910. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27911. if ($type !== 'out') {
  27912. return;
  27913. }
  27914. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  27915. return;
  27916. }
  27917. $output .= $buffer;
  27918. if ($verbose) {
  27919. $io->writeError($buffer, false);
  27920. }
  27921. };
  27922. $status = $this->process->execute($command, $handler, $cwd);
  27923. if (0 === $status) {
  27924. return $output;
  27925. }
  27926. $errorOutput = $this->process->getErrorOutput();
  27927. $fullOutput = implode("\n", array($output, $errorOutput));
  27928. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  27929. && false === stripos($fullOutput, 'authorization failed')
  27930. && false === stripos($fullOutput, 'svn: E170001:')
  27931. && false === stripos($fullOutput, 'svn: E215004:')) {
  27932. throw new \RuntimeException($fullOutput);
  27933. }
  27934. if (!$this->hasAuth()) {
  27935. $this->doAuthDance();
  27936. }
  27937. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  27938. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  27939. }
  27940. throw new \RuntimeException(
  27941. 'wrong credentials provided ('.$fullOutput.')'
  27942. );
  27943. }
  27944. public function setCacheCredentials($cacheCredentials)
  27945. {
  27946. $this->cacheCredentials = $cacheCredentials;
  27947. }
  27948. protected function doAuthDance()
  27949. {
  27950. if (!$this->io->isInteractive()) {
  27951. throw new \RuntimeException(
  27952. 'can not ask for authentication in non interactive mode'
  27953. );
  27954. }
  27955. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  27956. $this->hasAuth = true;
  27957. $this->credentials['username'] = $this->io->ask("Username: ");
  27958. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  27959. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  27960. return $this;
  27961. }
  27962. protected function getCommand($cmd, $url, $path = null)
  27963. {
  27964. $cmd = sprintf(
  27965. '%s %s%s %s',
  27966. $cmd,
  27967. '--non-interactive ',
  27968. $this->getCredentialString(),
  27969. ProcessExecutor::escape($url)
  27970. );
  27971. if ($path) {
  27972. $cmd .= ' ' . ProcessExecutor::escape($path);
  27973. }
  27974. return $cmd;
  27975. }
  27976. protected function getCredentialString()
  27977. {
  27978. if (!$this->hasAuth()) {
  27979. return '';
  27980. }
  27981. return sprintf(
  27982. ' %s--username %s --password %s ',
  27983. $this->getAuthCache(),
  27984. ProcessExecutor::escape($this->getUsername()),
  27985. ProcessExecutor::escape($this->getPassword())
  27986. );
  27987. }
  27988. protected function getPassword()
  27989. {
  27990. if ($this->credentials === null) {
  27991. throw new \LogicException("No svn auth detected.");
  27992. }
  27993. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  27994. }
  27995. protected function getUsername()
  27996. {
  27997. if ($this->credentials === null) {
  27998. throw new \LogicException("No svn auth detected.");
  27999. }
  28000. return $this->credentials['username'];
  28001. }
  28002. protected function hasAuth()
  28003. {
  28004. if (null !== $this->hasAuth) {
  28005. return $this->hasAuth;
  28006. }
  28007. if (false === $this->createAuthFromConfig()) {
  28008. $this->createAuthFromUrl();
  28009. }
  28010. return $this->hasAuth;
  28011. }
  28012. protected function getAuthCache()
  28013. {
  28014. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  28015. }
  28016. private function createAuthFromConfig()
  28017. {
  28018. if (!$this->config->has('http-basic')) {
  28019. return $this->hasAuth = false;
  28020. }
  28021. $authConfig = $this->config->get('http-basic');
  28022. $host = parse_url($this->url, PHP_URL_HOST);
  28023. if (isset($authConfig[$host])) {
  28024. $this->credentials['username'] = $authConfig[$host]['username'];
  28025. $this->credentials['password'] = $authConfig[$host]['password'];
  28026. return $this->hasAuth = true;
  28027. }
  28028. return $this->hasAuth = false;
  28029. }
  28030. private function createAuthFromUrl()
  28031. {
  28032. $uri = parse_url($this->url);
  28033. if (empty($uri['user'])) {
  28034. return $this->hasAuth = false;
  28035. }
  28036. $this->credentials['username'] = $uri['user'];
  28037. if (!empty($uri['pass'])) {
  28038. $this->credentials['password'] = $uri['pass'];
  28039. }
  28040. return $this->hasAuth = true;
  28041. }
  28042. public function binaryVersion()
  28043. {
  28044. if (!self::$version) {
  28045. if (0 === $this->process->execute('svn --version', $output)) {
  28046. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  28047. self::$version = $match[1];
  28048. }
  28049. }
  28050. }
  28051. return self::$version;
  28052. }
  28053. }
  28054. <?php
  28055. namespace Composer\Util;
  28056. use Composer\CaBundle\CaBundle;
  28057. final class TlsHelper
  28058. {
  28059. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  28060. {
  28061. $names = self::getCertificateNames($certificate);
  28062. if (empty($names)) {
  28063. return false;
  28064. }
  28065. $combinedNames = array_merge($names['san'], array($names['cn']));
  28066. $hostname = strtolower($hostname);
  28067. foreach ($combinedNames as $certName) {
  28068. $matcher = self::certNameMatcher($certName);
  28069. if ($matcher && $matcher($hostname)) {
  28070. $cn = $names['cn'];
  28071. return true;
  28072. }
  28073. }
  28074. return false;
  28075. }
  28076. public static function getCertificateNames($certificate)
  28077. {
  28078. if (is_array($certificate)) {
  28079. $info = $certificate;
  28080. } elseif (CaBundle::isOpensslParseSafe()) {
  28081. $info = openssl_x509_parse($certificate, false);
  28082. }
  28083. if (!isset($info['subject']['commonName'])) {
  28084. return null;
  28085. }
  28086. $commonName = strtolower($info['subject']['commonName']);
  28087. $subjectAltNames = array();
  28088. if (isset($info['extensions']['subjectAltName'])) {
  28089. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  28090. $subjectAltNames = array_filter(array_map(function ($name) {
  28091. if (0 === strpos($name, 'DNS:')) {
  28092. return strtolower(ltrim(substr($name, 4)));
  28093. }
  28094. return null;
  28095. }, $subjectAltNames));
  28096. $subjectAltNames = array_values($subjectAltNames);
  28097. }
  28098. return array(
  28099. 'cn' => $commonName,
  28100. 'san' => $subjectAltNames,
  28101. );
  28102. }
  28103. public static function getCertificateFingerprint($certificate)
  28104. {
  28105. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  28106. $pubkeypem = $pubkeydetails['key'];
  28107. $start = '-----BEGIN PUBLIC KEY-----';
  28108. $end = '-----END PUBLIC KEY-----';
  28109. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  28110. $der = base64_decode($pemtrim);
  28111. return sha1($der);
  28112. }
  28113. public static function isOpensslParseSafe()
  28114. {
  28115. return CaBundle::isOpensslParseSafe();
  28116. }
  28117. private static function certNameMatcher($certName)
  28118. {
  28119. $wildcards = substr_count($certName, '*');
  28120. if (0 === $wildcards) {
  28121. return function ($hostname) use ($certName) {
  28122. return $hostname === $certName;
  28123. };
  28124. }
  28125. if (1 === $wildcards) {
  28126. $components = explode('.', $certName);
  28127. if (3 > count($components)) {
  28128. return;
  28129. }
  28130. $firstComponent = $components[0];
  28131. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  28132. return;
  28133. }
  28134. $wildcardRegex = preg_quote($certName);
  28135. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  28136. $wildcardRegex = "{^{$wildcardRegex}$}";
  28137. return function ($hostname) use ($wildcardRegex) {
  28138. return 1 === preg_match($wildcardRegex, $hostname);
  28139. };
  28140. }
  28141. }
  28142. }
  28143. <?php
  28144. namespace Composer\Util;
  28145. use Composer\Config;
  28146. class Url
  28147. {
  28148. public static function updateDistReference(Config $config, $url, $ref)
  28149. {
  28150. $host = parse_url($url, PHP_URL_HOST);
  28151. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  28152. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  28153. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28154. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  28155. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28156. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  28157. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28158. }
  28159. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  28160. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  28161. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  28162. }
  28163. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  28164. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  28165. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  28166. }
  28167. } elseif (in_array($host, $config->get('github-domains'), true)) {
  28168. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  28169. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  28170. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  28171. }
  28172. return $url;
  28173. }
  28174. }
  28175. <?php
  28176. namespace Composer\Util;
  28177. class Zip
  28178. {
  28179. public static function getComposerJson($pathToZip)
  28180. {
  28181. if (!extension_loaded('zip')) {
  28182. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  28183. }
  28184. $zip = new \ZipArchive();
  28185. if ($zip->open($pathToZip) !== true) {
  28186. return null;
  28187. }
  28188. if (0 == $zip->numFiles) {
  28189. $zip->close();
  28190. return null;
  28191. }
  28192. $foundFileIndex = self::locateFile($zip, 'composer.json');
  28193. if (false === $foundFileIndex) {
  28194. $zip->close();
  28195. return null;
  28196. }
  28197. $content = null;
  28198. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  28199. $stream = $zip->getStream($configurationFileName);
  28200. if (false !== $stream) {
  28201. $content = stream_get_contents($stream);
  28202. }
  28203. $zip->close();
  28204. return $content;
  28205. }
  28206. private static function locateFile(\ZipArchive $zip, $filename)
  28207. {
  28208. $indexOfShortestMatch = false;
  28209. $lengthOfShortestMatch = -1;
  28210. for ($i = 0; $i < $zip->numFiles; $i++) {
  28211. $stat = $zip->statIndex($i);
  28212. if (strcmp(basename($stat['name']), $filename) === 0) {
  28213. $directoryName = dirname($stat['name']);
  28214. if ($directoryName === '.') {
  28215. return $i;
  28216. }
  28217. if (strpos($directoryName, '\\') !== false ||
  28218. strpos($directoryName, '/') !== false) {
  28219. continue;
  28220. }
  28221. $length = strlen($stat['name']);
  28222. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  28223. $contents = $zip->getFromIndex($i);
  28224. if ($contents !== false) {
  28225. $indexOfShortestMatch = $i;
  28226. $lengthOfShortestMatch = $length;
  28227. }
  28228. }
  28229. }
  28230. }
  28231. return $indexOfShortestMatch;
  28232. }
  28233. }
  28234. <?php
  28235. namespace Composer;
  28236. use Symfony\Component\Console\Output\OutputInterface;
  28237. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  28238. class XdebugHandler extends XdebugHandler\XdebugHandler
  28239. {
  28240. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  28241. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  28242. public function __construct(OutputInterface $output)
  28243. {
  28244. parent::__construct('composer', '--ansi');
  28245. }
  28246. }
  28247. <?php
  28248. function includeIfExists($file)
  28249. {
  28250. return file_exists($file) ? include $file : false;
  28251. }
  28252. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  28253. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  28254. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  28255. exit(1);
  28256. }
  28257. return $loader;
  28258. <?php
  28259. /*
  28260. * This file is part of Composer.
  28261. *
  28262. * (c) Nils Adermann <naderman@naderman.de>
  28263. * Jordi Boggiano <j.boggiano@seld.be>
  28264. *
  28265. * For the full copyright and license information, please view the LICENSE
  28266. * file that was distributed with this source code.
  28267. */
  28268. namespace Composer\Autoload;
  28269. /**
  28270. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  28271. *
  28272. * $loader = new \Composer\Autoload\ClassLoader();
  28273. *
  28274. * // register classes with namespaces
  28275. * $loader->add('Symfony\Component', __DIR__.'/component');
  28276. * $loader->add('Symfony', __DIR__.'/framework');
  28277. *
  28278. * // activate the autoloader
  28279. * $loader->register();
  28280. *
  28281. * // to enable searching the include path (eg. for PEAR packages)
  28282. * $loader->setUseIncludePath(true);
  28283. *
  28284. * In this example, if you try to use a class in the Symfony\Component
  28285. * namespace or one of its children (Symfony\Component\Console for instance),
  28286. * the autoloader will first look for the class under the component/
  28287. * directory, and it will then fallback to the framework/ directory if not
  28288. * found before giving up.
  28289. *
  28290. * This class is loosely based on the Symfony UniversalClassLoader.
  28291. *
  28292. * @author Fabien Potencier <fabien@symfony.com>
  28293. * @author Jordi Boggiano <j.boggiano@seld.be>
  28294. * @see http://www.php-fig.org/psr/psr-0/
  28295. * @see http://www.php-fig.org/psr/psr-4/
  28296. */
  28297. class ClassLoader
  28298. {
  28299. // PSR-4
  28300. private $prefixLengthsPsr4 = array();
  28301. private $prefixDirsPsr4 = array();
  28302. private $fallbackDirsPsr4 = array();
  28303. // PSR-0
  28304. private $prefixesPsr0 = array();
  28305. private $fallbackDirsPsr0 = array();
  28306. private $useIncludePath = false;
  28307. private $classMap = array();
  28308. private $classMapAuthoritative = false;
  28309. private $missingClasses = array();
  28310. private $apcuPrefix;
  28311. public function getPrefixes()
  28312. {
  28313. if (!empty($this->prefixesPsr0)) {
  28314. return call_user_func_array('array_merge', $this->prefixesPsr0);
  28315. }
  28316. return array();
  28317. }
  28318. public function getPrefixesPsr4()
  28319. {
  28320. return $this->prefixDirsPsr4;
  28321. }
  28322. public function getFallbackDirs()
  28323. {
  28324. return $this->fallbackDirsPsr0;
  28325. }
  28326. public function getFallbackDirsPsr4()
  28327. {
  28328. return $this->fallbackDirsPsr4;
  28329. }
  28330. public function getClassMap()
  28331. {
  28332. return $this->classMap;
  28333. }
  28334. /**
  28335. * @param array $classMap Class to filename map
  28336. */
  28337. public function addClassMap(array $classMap)
  28338. {
  28339. if ($this->classMap) {
  28340. $this->classMap = array_merge($this->classMap, $classMap);
  28341. } else {
  28342. $this->classMap = $classMap;
  28343. }
  28344. }
  28345. /**
  28346. * Registers a set of PSR-0 directories for a given prefix, either
  28347. * appending or prepending to the ones previously set for this prefix.
  28348. *
  28349. * @param string $prefix The prefix
  28350. * @param array|string $paths The PSR-0 root directories
  28351. * @param bool $prepend Whether to prepend the directories
  28352. */
  28353. public function add($prefix, $paths, $prepend = false)
  28354. {
  28355. if (!$prefix) {
  28356. if ($prepend) {
  28357. $this->fallbackDirsPsr0 = array_merge(
  28358. (array) $paths,
  28359. $this->fallbackDirsPsr0
  28360. );
  28361. } else {
  28362. $this->fallbackDirsPsr0 = array_merge(
  28363. $this->fallbackDirsPsr0,
  28364. (array) $paths
  28365. );
  28366. }
  28367. return;
  28368. }
  28369. $first = $prefix[0];
  28370. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  28371. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  28372. return;
  28373. }
  28374. if ($prepend) {
  28375. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28376. (array) $paths,
  28377. $this->prefixesPsr0[$first][$prefix]
  28378. );
  28379. } else {
  28380. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28381. $this->prefixesPsr0[$first][$prefix],
  28382. (array) $paths
  28383. );
  28384. }
  28385. }
  28386. /**
  28387. * Registers a set of PSR-4 directories for a given namespace, either
  28388. * appending or prepending to the ones previously set for this namespace.
  28389. *
  28390. * @param string $prefix The prefix/namespace, with trailing '\\'
  28391. * @param array|string $paths The PSR-4 base directories
  28392. * @param bool $prepend Whether to prepend the directories
  28393. *
  28394. * @throws \InvalidArgumentException
  28395. */
  28396. public function addPsr4($prefix, $paths, $prepend = false)
  28397. {
  28398. if (!$prefix) {
  28399. // Register directories for the root namespace.
  28400. if ($prepend) {
  28401. $this->fallbackDirsPsr4 = array_merge(
  28402. (array) $paths,
  28403. $this->fallbackDirsPsr4
  28404. );
  28405. } else {
  28406. $this->fallbackDirsPsr4 = array_merge(
  28407. $this->fallbackDirsPsr4,
  28408. (array) $paths
  28409. );
  28410. }
  28411. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  28412. // Register directories for a new namespace.
  28413. $length = strlen($prefix);
  28414. if ('\\' !== $prefix[$length - 1]) {
  28415. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28416. }
  28417. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28418. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28419. } elseif ($prepend) {
  28420. // Prepend directories for an already registered namespace.
  28421. $this->prefixDirsPsr4[$prefix] = array_merge(
  28422. (array) $paths,
  28423. $this->prefixDirsPsr4[$prefix]
  28424. );
  28425. } else {
  28426. // Append directories for an already registered namespace.
  28427. $this->prefixDirsPsr4[$prefix] = array_merge(
  28428. $this->prefixDirsPsr4[$prefix],
  28429. (array) $paths
  28430. );
  28431. }
  28432. }
  28433. /**
  28434. * Registers a set of PSR-0 directories for a given prefix,
  28435. * replacing any others previously set for this prefix.
  28436. *
  28437. * @param string $prefix The prefix
  28438. * @param array|string $paths The PSR-0 base directories
  28439. */
  28440. public function set($prefix, $paths)
  28441. {
  28442. if (!$prefix) {
  28443. $this->fallbackDirsPsr0 = (array) $paths;
  28444. } else {
  28445. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  28446. }
  28447. }
  28448. /**
  28449. * Registers a set of PSR-4 directories for a given namespace,
  28450. * replacing any others previously set for this namespace.
  28451. *
  28452. * @param string $prefix The prefix/namespace, with trailing '\\'
  28453. * @param array|string $paths The PSR-4 base directories
  28454. *
  28455. * @throws \InvalidArgumentException
  28456. */
  28457. public function setPsr4($prefix, $paths)
  28458. {
  28459. if (!$prefix) {
  28460. $this->fallbackDirsPsr4 = (array) $paths;
  28461. } else {
  28462. $length = strlen($prefix);
  28463. if ('\\' !== $prefix[$length - 1]) {
  28464. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28465. }
  28466. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28467. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28468. }
  28469. }
  28470. /**
  28471. * Turns on searching the include path for class files.
  28472. *
  28473. * @param bool $useIncludePath
  28474. */
  28475. public function setUseIncludePath($useIncludePath)
  28476. {
  28477. $this->useIncludePath = $useIncludePath;
  28478. }
  28479. /**
  28480. * Can be used to check if the autoloader uses the include path to check
  28481. * for classes.
  28482. *
  28483. * @return bool
  28484. */
  28485. public function getUseIncludePath()
  28486. {
  28487. return $this->useIncludePath;
  28488. }
  28489. /**
  28490. * Turns off searching the prefix and fallback directories for classes
  28491. * that have not been registered with the class map.
  28492. *
  28493. * @param bool $classMapAuthoritative
  28494. */
  28495. public function setClassMapAuthoritative($classMapAuthoritative)
  28496. {
  28497. $this->classMapAuthoritative = $classMapAuthoritative;
  28498. }
  28499. /**
  28500. * Should class lookup fail if not found in the current class map?
  28501. *
  28502. * @return bool
  28503. */
  28504. public function isClassMapAuthoritative()
  28505. {
  28506. return $this->classMapAuthoritative;
  28507. }
  28508. /**
  28509. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  28510. *
  28511. * @param string|null $apcuPrefix
  28512. */
  28513. public function setApcuPrefix($apcuPrefix)
  28514. {
  28515. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  28516. }
  28517. /**
  28518. * The APCu prefix in use, or null if APCu caching is not enabled.
  28519. *
  28520. * @return string|null
  28521. */
  28522. public function getApcuPrefix()
  28523. {
  28524. return $this->apcuPrefix;
  28525. }
  28526. /**
  28527. * Registers this instance as an autoloader.
  28528. *
  28529. * @param bool $prepend Whether to prepend the autoloader or not
  28530. */
  28531. public function register($prepend = false)
  28532. {
  28533. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  28534. }
  28535. /**
  28536. * Unregisters this instance as an autoloader.
  28537. */
  28538. public function unregister()
  28539. {
  28540. spl_autoload_unregister(array($this, 'loadClass'));
  28541. }
  28542. /**
  28543. * Loads the given class or interface.
  28544. *
  28545. * @param string $class The name of the class
  28546. * @return bool|null True if loaded, null otherwise
  28547. */
  28548. public function loadClass($class)
  28549. {
  28550. if ($file = $this->findFile($class)) {
  28551. includeFile($file);
  28552. return true;
  28553. }
  28554. }
  28555. /**
  28556. * Finds the path to the file where the class is defined.
  28557. *
  28558. * @param string $class The name of the class
  28559. *
  28560. * @return string|false The path if found, false otherwise
  28561. */
  28562. public function findFile($class)
  28563. {
  28564. // class map lookup
  28565. if (isset($this->classMap[$class])) {
  28566. return $this->classMap[$class];
  28567. }
  28568. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  28569. return false;
  28570. }
  28571. if (null !== $this->apcuPrefix) {
  28572. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  28573. if ($hit) {
  28574. return $file;
  28575. }
  28576. }
  28577. $file = $this->findFileWithExtension($class, '.php');
  28578. // Search for Hack files if we are running on HHVM
  28579. if (false === $file && defined('HHVM_VERSION')) {
  28580. $file = $this->findFileWithExtension($class, '.hh');
  28581. }
  28582. if (null !== $this->apcuPrefix) {
  28583. apcu_add($this->apcuPrefix.$class, $file);
  28584. }
  28585. if (false === $file) {
  28586. // Remember that this class does not exist.
  28587. $this->missingClasses[$class] = true;
  28588. }
  28589. return $file;
  28590. }
  28591. private function findFileWithExtension($class, $ext)
  28592. {
  28593. // PSR-4 lookup
  28594. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  28595. $first = $class[0];
  28596. if (isset($this->prefixLengthsPsr4[$first])) {
  28597. $subPath = $class;
  28598. while (false !== $lastPos = strrpos($subPath, '\\')) {
  28599. $subPath = substr($subPath, 0, $lastPos);
  28600. $search = $subPath . '\\';
  28601. if (isset($this->prefixDirsPsr4[$search])) {
  28602. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  28603. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  28604. if (file_exists($file = $dir . $pathEnd)) {
  28605. return $file;
  28606. }
  28607. }
  28608. }
  28609. }
  28610. }
  28611. // PSR-4 fallback dirs
  28612. foreach ($this->fallbackDirsPsr4 as $dir) {
  28613. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  28614. return $file;
  28615. }
  28616. }
  28617. // PSR-0 lookup
  28618. if (false !== $pos = strrpos($class, '\\')) {
  28619. // namespaced class name
  28620. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  28621. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  28622. } else {
  28623. // PEAR-like class name
  28624. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  28625. }
  28626. if (isset($this->prefixesPsr0[$first])) {
  28627. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  28628. if (0 === strpos($class, $prefix)) {
  28629. foreach ($dirs as $dir) {
  28630. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28631. return $file;
  28632. }
  28633. }
  28634. }
  28635. }
  28636. }
  28637. // PSR-0 fallback dirs
  28638. foreach ($this->fallbackDirsPsr0 as $dir) {
  28639. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28640. return $file;
  28641. }
  28642. }
  28643. // PSR-0 include paths.
  28644. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  28645. return $file;
  28646. }
  28647. return false;
  28648. }
  28649. }
  28650. /**
  28651. * Scope isolated include.
  28652. *
  28653. * Prevents access to $this/self from included files.
  28654. */
  28655. function includeFile($file)
  28656. {
  28657. include $file;
  28658. }
  28659. {
  28660. "$schema": "http://json-schema.org/draft-04/schema#",
  28661. "description": "A representation of packages metadata.",
  28662. "type": "object",
  28663. "oneOf": [
  28664. { "required": [ "packages" ] },
  28665. { "required": [ "providers" ] },
  28666. { "required": [ "provider-includes", "providers-url" ] }
  28667. ],
  28668. "properties": {
  28669. "packages": {
  28670. "type": ["object", "array"],
  28671. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28672. "additionalProperties": { "$ref": "#/definitions/versions" }
  28673. },
  28674. "providers-url": {
  28675. "type": "string",
  28676. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28677. },
  28678. "provider-includes": {
  28679. "type": "object",
  28680. "description": "A hashmap of provider listings.",
  28681. "additionalProperties": { "$ref": "#/definitions/provider" }
  28682. },
  28683. "providers": {
  28684. "type": "object",
  28685. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28686. "additionalProperties": { "$ref": "#/definitions/provider" }
  28687. },
  28688. "notify-batch": {
  28689. "type": "string",
  28690. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28691. },
  28692. "search": {
  28693. "type": "string",
  28694. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28695. },
  28696. "warning": {
  28697. "type": "string",
  28698. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28699. }
  28700. },
  28701. "definitions": {
  28702. "versions": {
  28703. "type": "object",
  28704. "description": "A hashmap of versions and their metadata.",
  28705. "additionalProperties": { "$ref": "#/definitions/version" }
  28706. },
  28707. "version": {
  28708. "type": "object",
  28709. "oneOf": [
  28710. { "$ref": "#/definitions/package" },
  28711. { "$ref": "#/definitions/metapackage" }
  28712. ]
  28713. },
  28714. "package-base": {
  28715. "properties": {
  28716. "name": { "type": "string" },
  28717. "type": { "type": "string" },
  28718. "version": { "type": "string" },
  28719. "version_normalized": {
  28720. "type": "string",
  28721. "description": "Normalized version, optional but can save computational time on client side."
  28722. },
  28723. "autoload": { "type": "object" },
  28724. "require": { "type": "object" },
  28725. "replace": { "type": "object" },
  28726. "conflict": { "type": "object" },
  28727. "provide": { "type": "object" },
  28728. "time": { "type": "string" }
  28729. },
  28730. "additionalProperties": true
  28731. },
  28732. "package": {
  28733. "allOf": [
  28734. { "$ref": "#/definitions/package-base" },
  28735. {
  28736. "properties": {
  28737. "dist": { "type": "object" },
  28738. "source": { "type": "object" }
  28739. }
  28740. },
  28741. { "oneOf": [
  28742. { "required": [ "name", "version", "source" ] },
  28743. { "required": [ "name", "version", "dist" ] }
  28744. ] }
  28745. ]
  28746. },
  28747. "metapackage": {
  28748. "allOf": [
  28749. { "$ref": "#/definitions/package-base" },
  28750. {
  28751. "properties": {
  28752. "type": { "type": "string", "enum": [ "metapackage" ] }
  28753. },
  28754. "required": [ "name", "version", "type" ]
  28755. }
  28756. ]
  28757. },
  28758. "provider": {
  28759. "type": "object",
  28760. "properties": {
  28761. "sha256": {
  28762. "type": "string",
  28763. "description": "Hash value that can be used to validate the resource."
  28764. }
  28765. }
  28766. }
  28767. }
  28768. }
  28769. {
  28770. "$schema": "http://json-schema.org/draft-04/schema#",
  28771. "name": "Package",
  28772. "type": "object",
  28773. "additionalProperties": false,
  28774. "required": [ "name", "description" ],
  28775. "properties": {
  28776. "name": {
  28777. "type": "string",
  28778. "description": "Package name, including 'vendor-name/' prefix."
  28779. },
  28780. "type": {
  28781. "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.",
  28782. "type": "string"
  28783. },
  28784. "target-dir": {
  28785. "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.",
  28786. "type": "string"
  28787. },
  28788. "description": {
  28789. "type": "string",
  28790. "description": "Short package description."
  28791. },
  28792. "keywords": {
  28793. "type": "array",
  28794. "items": {
  28795. "type": "string",
  28796. "description": "A tag/keyword that this package relates to."
  28797. }
  28798. },
  28799. "homepage": {
  28800. "type": "string",
  28801. "description": "Homepage URL for the project.",
  28802. "format": "uri"
  28803. },
  28804. "readme": {
  28805. "type": "string",
  28806. "description": "Relative path to the readme document."
  28807. },
  28808. "version": {
  28809. "type": "string",
  28810. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  28811. },
  28812. "time": {
  28813. "type": "string",
  28814. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28815. },
  28816. "license": {
  28817. "type": ["string", "array"],
  28818. "description": "License name. Or an array of license names."
  28819. },
  28820. "authors": {
  28821. "$ref": "#/definitions/authors"
  28822. },
  28823. "require": {
  28824. "type": "object",
  28825. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28826. "additionalProperties": {
  28827. "type": "string"
  28828. }
  28829. },
  28830. "replace": {
  28831. "type": "object",
  28832. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28833. "additionalProperties": {
  28834. "type": "string"
  28835. }
  28836. },
  28837. "conflict": {
  28838. "type": "object",
  28839. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28840. "additionalProperties": {
  28841. "type": "string"
  28842. }
  28843. },
  28844. "provide": {
  28845. "type": "object",
  28846. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28847. "additionalProperties": {
  28848. "type": "string"
  28849. }
  28850. },
  28851. "require-dev": {
  28852. "type": "object",
  28853. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28854. "additionalProperties": {
  28855. "type": "string"
  28856. }
  28857. },
  28858. "suggest": {
  28859. "type": "object",
  28860. "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).",
  28861. "additionalProperties": {
  28862. "type": "string"
  28863. }
  28864. },
  28865. "config": {
  28866. "type": "object",
  28867. "description": "Composer options.",
  28868. "properties": {
  28869. "process-timeout": {
  28870. "type": "integer",
  28871. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28872. },
  28873. "use-include-path": {
  28874. "type": "boolean",
  28875. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28876. },
  28877. "preferred-install": {
  28878. "type": ["string", "object"],
  28879. "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\"}."
  28880. },
  28881. "notify-on-install": {
  28882. "type": "boolean",
  28883. "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."
  28884. },
  28885. "github-protocols": {
  28886. "type": "array",
  28887. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28888. "items": {
  28889. "type": "string"
  28890. }
  28891. },
  28892. "github-oauth": {
  28893. "type": "object",
  28894. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28895. "additionalProperties": {
  28896. "type": "string"
  28897. }
  28898. },
  28899. "gitlab-oauth": {
  28900. "type": "object",
  28901. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28902. "additionalProperties": {
  28903. "type": "string"
  28904. }
  28905. },
  28906. "gitlab-token": {
  28907. "type": "object",
  28908. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28909. "additionalProperties": true
  28910. },
  28911. "disable-tls": {
  28912. "type": "boolean",
  28913. "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."
  28914. },
  28915. "secure-http": {
  28916. "type": "boolean",
  28917. "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."
  28918. },
  28919. "cafile": {
  28920. "type": "string",
  28921. "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."
  28922. },
  28923. "capath": {
  28924. "type": "string",
  28925. "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."
  28926. },
  28927. "http-basic": {
  28928. "type": "object",
  28929. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  28930. "additionalProperties": {
  28931. "type": "object",
  28932. "required": ["username", "password"],
  28933. "properties": {
  28934. "username": {
  28935. "type": "string",
  28936. "description": "The username used for HTTP Basic authentication"
  28937. },
  28938. "password": {
  28939. "type": "string",
  28940. "description": "The password used for HTTP Basic authentication"
  28941. }
  28942. }
  28943. }
  28944. },
  28945. "store-auths": {
  28946. "type": ["string", "boolean"],
  28947. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  28948. },
  28949. "platform": {
  28950. "type": "object",
  28951. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  28952. "additionalProperties": {
  28953. "type": "string"
  28954. }
  28955. },
  28956. "vendor-dir": {
  28957. "type": "string",
  28958. "description": "The location where all packages are installed, defaults to \"vendor\"."
  28959. },
  28960. "bin-dir": {
  28961. "type": "string",
  28962. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  28963. },
  28964. "data-dir": {
  28965. "type": "string",
  28966. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  28967. },
  28968. "cache-dir": {
  28969. "type": "string",
  28970. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  28971. },
  28972. "cache-files-dir": {
  28973. "type": "string",
  28974. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  28975. },
  28976. "cache-repo-dir": {
  28977. "type": "string",
  28978. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  28979. },
  28980. "cache-vcs-dir": {
  28981. "type": "string",
  28982. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  28983. },
  28984. "cache-ttl": {
  28985. "type": "integer",
  28986. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  28987. },
  28988. "cache-files-ttl": {
  28989. "type": "integer",
  28990. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  28991. },
  28992. "cache-files-maxsize": {
  28993. "type": ["string", "integer"],
  28994. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  28995. },
  28996. "bin-compat": {
  28997. "enum": ["auto", "full"],
  28998. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  28999. },
  29000. "discard-changes": {
  29001. "type": ["string", "boolean"],
  29002. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  29003. },
  29004. "autoloader-suffix": {
  29005. "type": "string",
  29006. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  29007. },
  29008. "optimize-autoloader": {
  29009. "type": "boolean",
  29010. "description": "Always optimize when dumping the autoloader."
  29011. },
  29012. "prepend-autoloader": {
  29013. "type": "boolean",
  29014. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  29015. },
  29016. "classmap-authoritative": {
  29017. "type": "boolean",
  29018. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  29019. },
  29020. "apcu-autoloader": {
  29021. "type": "boolean",
  29022. "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."
  29023. },
  29024. "github-domains": {
  29025. "type": "array",
  29026. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  29027. "items": {
  29028. "type": "string"
  29029. }
  29030. },
  29031. "github-expose-hostname": {
  29032. "type": "boolean",
  29033. "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."
  29034. },
  29035. "gitlab-domains": {
  29036. "type": "array",
  29037. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  29038. "items": {
  29039. "type": "string"
  29040. }
  29041. },
  29042. "use-github-api": {
  29043. "type": "boolean",
  29044. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  29045. },
  29046. "archive-format": {
  29047. "type": "string",
  29048. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  29049. },
  29050. "archive-dir": {
  29051. "type": "string",
  29052. "description": "The default archive path when not provided on cli, defaults to \".\"."
  29053. },
  29054. "htaccess-protect": {
  29055. "type": "boolean",
  29056. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  29057. },
  29058. "sort-packages": {
  29059. "type": "boolean",
  29060. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  29061. }
  29062. }
  29063. },
  29064. "extra": {
  29065. "type": ["object", "array"],
  29066. "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.",
  29067. "additionalProperties": true
  29068. },
  29069. "autoload": {
  29070. "$ref": "#/definitions/autoload"
  29071. },
  29072. "autoload-dev": {
  29073. "type": "object",
  29074. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  29075. "properties": {
  29076. "psr-0": {
  29077. "type": "object",
  29078. "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.",
  29079. "additionalProperties": {
  29080. "type": ["string", "array"],
  29081. "items": {
  29082. "type": "string"
  29083. }
  29084. }
  29085. },
  29086. "psr-4": {
  29087. "type": "object",
  29088. "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.",
  29089. "additionalProperties": {
  29090. "type": ["string", "array"],
  29091. "items": {
  29092. "type": "string"
  29093. }
  29094. }
  29095. },
  29096. "classmap": {
  29097. "type": "array",
  29098. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29099. },
  29100. "files": {
  29101. "type": "array",
  29102. "description": "This is an array of files that are always required on every request."
  29103. }
  29104. }
  29105. },
  29106. "archive": {
  29107. "type": ["object"],
  29108. "description": "Options for creating package archives for distribution.",
  29109. "properties": {
  29110. "exclude": {
  29111. "type": "array",
  29112. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  29113. }
  29114. }
  29115. },
  29116. "repositories": {
  29117. "type": ["object", "array"],
  29118. "description": "A set of additional repositories where packages can be found.",
  29119. "additionalProperties": {
  29120. "oneOf": [
  29121. { "$ref": "#/definitions/repository" },
  29122. { "type": "boolean", "enum": [false] }
  29123. ]
  29124. },
  29125. "items": {
  29126. "oneOf": [
  29127. { "$ref": "#/definitions/repository" },
  29128. {
  29129. "type": "object",
  29130. "additionalProperties": { "type": "boolean", "enum": [false] },
  29131. "minProperties": 1,
  29132. "maxProperties": 1
  29133. }
  29134. ]
  29135. }
  29136. },
  29137. "minimum-stability": {
  29138. "type": ["string"],
  29139. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  29140. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  29141. },
  29142. "prefer-stable": {
  29143. "type": ["boolean"],
  29144. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  29145. },
  29146. "bin": {
  29147. "type": ["string", "array"],
  29148. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29149. "items": {
  29150. "type": "string"
  29151. }
  29152. },
  29153. "include-path": {
  29154. "type": ["array"],
  29155. "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.",
  29156. "items": {
  29157. "type": "string"
  29158. }
  29159. },
  29160. "scripts": {
  29161. "type": ["object"],
  29162. "description": "Script listeners that will be executed before/after some events.",
  29163. "properties": {
  29164. "pre-install-cmd": {
  29165. "type": ["array", "string"],
  29166. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  29167. },
  29168. "post-install-cmd": {
  29169. "type": ["array", "string"],
  29170. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  29171. },
  29172. "pre-update-cmd": {
  29173. "type": ["array", "string"],
  29174. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  29175. },
  29176. "post-update-cmd": {
  29177. "type": ["array", "string"],
  29178. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  29179. },
  29180. "pre-status-cmd": {
  29181. "type": ["array", "string"],
  29182. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  29183. },
  29184. "post-status-cmd": {
  29185. "type": ["array", "string"],
  29186. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  29187. },
  29188. "pre-package-install": {
  29189. "type": ["array", "string"],
  29190. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  29191. },
  29192. "post-package-install": {
  29193. "type": ["array", "string"],
  29194. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  29195. },
  29196. "pre-package-update": {
  29197. "type": ["array", "string"],
  29198. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  29199. },
  29200. "post-package-update": {
  29201. "type": ["array", "string"],
  29202. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  29203. },
  29204. "pre-package-uninstall": {
  29205. "type": ["array", "string"],
  29206. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29207. },
  29208. "post-package-uninstall": {
  29209. "type": ["array", "string"],
  29210. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29211. },
  29212. "pre-autoload-dump": {
  29213. "type": ["array", "string"],
  29214. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29215. },
  29216. "post-autoload-dump": {
  29217. "type": ["array", "string"],
  29218. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29219. },
  29220. "post-root-package-install": {
  29221. "type": ["array", "string"],
  29222. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  29223. },
  29224. "post-create-project-cmd": {
  29225. "type": ["array", "string"],
  29226. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  29227. }
  29228. }
  29229. },
  29230. "scripts-descriptions": {
  29231. "type": ["object"],
  29232. "description": "Descriptions for custom commands, shown in console help.",
  29233. "additionalProperties": {
  29234. "type": "string"
  29235. }
  29236. },
  29237. "support": {
  29238. "type": "object",
  29239. "properties": {
  29240. "email": {
  29241. "type": "string",
  29242. "description": "Email address for support.",
  29243. "format": "email"
  29244. },
  29245. "issues": {
  29246. "type": "string",
  29247. "description": "URL to the issue tracker.",
  29248. "format": "uri"
  29249. },
  29250. "forum": {
  29251. "type": "string",
  29252. "description": "URL to the forum.",
  29253. "format": "uri"
  29254. },
  29255. "wiki": {
  29256. "type": "string",
  29257. "description": "URL to the wiki.",
  29258. "format": "uri"
  29259. },
  29260. "irc": {
  29261. "type": "string",
  29262. "description": "IRC channel for support, as irc://server/channel.",
  29263. "format": "uri"
  29264. },
  29265. "chat": {
  29266. "type": "string",
  29267. "description": "URL to the support chat.",
  29268. "format": "uri"
  29269. },
  29270. "source": {
  29271. "type": "string",
  29272. "description": "URL to browse or download the sources.",
  29273. "format": "uri"
  29274. },
  29275. "docs": {
  29276. "type": "string",
  29277. "description": "URL to the documentation.",
  29278. "format": "uri"
  29279. },
  29280. "rss": {
  29281. "type": "string",
  29282. "description": "URL to the RSS feed.",
  29283. "format": "uri"
  29284. }
  29285. }
  29286. },
  29287. "non-feature-branches": {
  29288. "type": ["array"],
  29289. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  29290. "items": {
  29291. "type": "string"
  29292. }
  29293. },
  29294. "abandoned": {
  29295. "type": ["boolean", "string"],
  29296. "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."
  29297. },
  29298. "_comment": {
  29299. "type": ["array", "string"],
  29300. "description": "A key to store comments in"
  29301. }
  29302. },
  29303. "definitions": {
  29304. "authors": {
  29305. "type": "array",
  29306. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  29307. "items": {
  29308. "type": "object",
  29309. "additionalProperties": false,
  29310. "required": [ "name"],
  29311. "properties": {
  29312. "name": {
  29313. "type": "string",
  29314. "description": "Full name of the author."
  29315. },
  29316. "email": {
  29317. "type": "string",
  29318. "description": "Email address of the author.",
  29319. "format": "email"
  29320. },
  29321. "homepage": {
  29322. "type": "string",
  29323. "description": "Homepage URL for the author.",
  29324. "format": "uri"
  29325. },
  29326. "role": {
  29327. "type": "string",
  29328. "description": "Author's role in the project."
  29329. }
  29330. }
  29331. }
  29332. },
  29333. "autoload": {
  29334. "type": "object",
  29335. "description": "Description of how the package can be autoloaded.",
  29336. "properties": {
  29337. "psr-0": {
  29338. "type": "object",
  29339. "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.",
  29340. "additionalProperties": {
  29341. "type": ["string", "array"],
  29342. "items": {
  29343. "type": "string"
  29344. }
  29345. }
  29346. },
  29347. "psr-4": {
  29348. "type": "object",
  29349. "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.",
  29350. "additionalProperties": {
  29351. "type": ["string", "array"],
  29352. "items": {
  29353. "type": "string"
  29354. }
  29355. }
  29356. },
  29357. "classmap": {
  29358. "type": "array",
  29359. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29360. },
  29361. "files": {
  29362. "type": "array",
  29363. "description": "This is an array of files that are always required on every request."
  29364. },
  29365. "exclude-from-classmap": {
  29366. "type": "array",
  29367. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  29368. }
  29369. }
  29370. },
  29371. "repository": {
  29372. "type": "object",
  29373. "oneOf": [
  29374. { "$ref": "#/definitions/composer-repository" },
  29375. { "$ref": "#/definitions/vcs-repository" },
  29376. { "$ref": "#/definitions/path-repository" },
  29377. { "$ref": "#/definitions/artifact-repository" },
  29378. { "$ref": "#/definitions/pear-repository" },
  29379. { "$ref": "#/definitions/package-repository" }
  29380. ]
  29381. },
  29382. "composer-repository": {
  29383. "type": "object",
  29384. "required": ["type", "url"],
  29385. "properties": {
  29386. "type": { "type": "string", "enum": ["composer"] },
  29387. "url": { "type": "string" },
  29388. "options": {
  29389. "type": "object",
  29390. "additionalProperties": true
  29391. },
  29392. "allow_ssl_downgrade": { "type": "boolean" },
  29393. "force-lazy-providers": { "type": "boolean" }
  29394. }
  29395. },
  29396. "vcs-repository": {
  29397. "type": "object",
  29398. "required": ["type", "url"],
  29399. "properties": {
  29400. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  29401. "url": { "type": "string" },
  29402. "no-api": { "type": "boolean" },
  29403. "secure-http": { "type": "boolean" },
  29404. "svn-cache-credentials": { "type": "boolean" },
  29405. "trunk-path": { "type": ["string", "boolean"] },
  29406. "branches-path": { "type": ["string", "boolean"] },
  29407. "tags-path": { "type": ["string", "boolean"] },
  29408. "package-path": { "type": "string" },
  29409. "depot": { "type": "string" },
  29410. "branch": { "type": "string" },
  29411. "unique_perforce_client_name": { "type": "string" },
  29412. "p4user": { "type": "string" },
  29413. "p4password": { "type": "string" }
  29414. }
  29415. },
  29416. "path-repository": {
  29417. "type": "object",
  29418. "required": ["type", "url"],
  29419. "properties": {
  29420. "type": { "type": "string", "enum": ["path"] },
  29421. "url": { "type": "string" },
  29422. "options": {
  29423. "type": "object",
  29424. "properties": {
  29425. "symlink": { "type": ["boolean", "null"] }
  29426. },
  29427. "additionalProperties": true
  29428. }
  29429. }
  29430. },
  29431. "artifact-repository": {
  29432. "type": "object",
  29433. "required": ["type", "url"],
  29434. "properties": {
  29435. "type": { "type": "string", "enum": ["artifact"] },
  29436. "url": { "type": "string" }
  29437. }
  29438. },
  29439. "pear-repository": {
  29440. "type": "object",
  29441. "required": ["type", "url"],
  29442. "properties": {
  29443. "type": { "type": "string", "enum": ["pear"] },
  29444. "url": { "type": "string" },
  29445. "vendor-alias": { "type": "string" }
  29446. }
  29447. },
  29448. "package-repository": {
  29449. "type": "object",
  29450. "required": ["type", "package"],
  29451. "properties": {
  29452. "type": { "type": "string", "enum": ["package"] },
  29453. "package": {
  29454. "oneOf": [
  29455. { "$ref": "#/definitions/inline-package" },
  29456. {
  29457. "type": "array",
  29458. "items": { "$ref": "#/definitions/inline-package" }
  29459. }
  29460. ]
  29461. }
  29462. }
  29463. },
  29464. "inline-package": {
  29465. "type": "object",
  29466. "required": ["name", "version"],
  29467. "properties": {
  29468. "name": {
  29469. "type": "string",
  29470. "description": "Package name, including 'vendor-name/' prefix."
  29471. },
  29472. "type": {
  29473. "type": "string"
  29474. },
  29475. "target-dir": {
  29476. "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.",
  29477. "type": "string"
  29478. },
  29479. "description": {
  29480. "type": "string"
  29481. },
  29482. "keywords": {
  29483. "type": "array",
  29484. "items": {
  29485. "type": "string"
  29486. }
  29487. },
  29488. "homepage": {
  29489. "type": "string",
  29490. "format": "uri"
  29491. },
  29492. "version": {
  29493. "type": "string"
  29494. },
  29495. "time": {
  29496. "type": "string"
  29497. },
  29498. "license": {
  29499. "type": [
  29500. "string",
  29501. "array"
  29502. ]
  29503. },
  29504. "authors": {
  29505. "$ref": "#/definitions/authors"
  29506. },
  29507. "require": {
  29508. "type": "object",
  29509. "additionalProperties": {
  29510. "type": "string"
  29511. }
  29512. },
  29513. "replace": {
  29514. "type": "object",
  29515. "additionalProperties": {
  29516. "type": "string"
  29517. }
  29518. },
  29519. "conflict": {
  29520. "type": "object",
  29521. "additionalProperties": {
  29522. "type": "string"
  29523. }
  29524. },
  29525. "provide": {
  29526. "type": "object",
  29527. "additionalProperties": {
  29528. "type": "string"
  29529. }
  29530. },
  29531. "require-dev": {
  29532. "type": "object",
  29533. "additionalProperties": {
  29534. "type": "string"
  29535. }
  29536. },
  29537. "suggest": {
  29538. "type": "object",
  29539. "additionalProperties": {
  29540. "type": "string"
  29541. }
  29542. },
  29543. "extra": {
  29544. "type": ["object", "array"],
  29545. "additionalProperties": true
  29546. },
  29547. "autoload": {
  29548. "$ref": "#/definitions/autoload"
  29549. },
  29550. "archive": {
  29551. "type": ["object"],
  29552. "properties": {
  29553. "exclude": {
  29554. "type": "array"
  29555. }
  29556. }
  29557. },
  29558. "bin": {
  29559. "type": ["string", "array"],
  29560. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29561. "items": {
  29562. "type": "string"
  29563. }
  29564. },
  29565. "include-path": {
  29566. "type": ["array"],
  29567. "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.",
  29568. "items": {
  29569. "type": "string"
  29570. }
  29571. },
  29572. "source": {
  29573. "type": "object",
  29574. "required": ["type", "url", "reference"],
  29575. "properties": {
  29576. "type": {
  29577. "type": "string"
  29578. },
  29579. "url": {
  29580. "type": "string"
  29581. },
  29582. "reference": {
  29583. "type": "string"
  29584. },
  29585. "mirrors": {
  29586. "type": "array"
  29587. }
  29588. }
  29589. },
  29590. "dist": {
  29591. "type": "object",
  29592. "required": ["type", "url"],
  29593. "properties": {
  29594. "type": {
  29595. "type": "string"
  29596. },
  29597. "url": {
  29598. "type": "string"
  29599. },
  29600. "reference": {
  29601. "type": "string"
  29602. },
  29603. "shasum": {
  29604. "type": "string"
  29605. },
  29606. "mirrors": {
  29607. "type": "array"
  29608. }
  29609. }
  29610. }
  29611. },
  29612. "additionalProperties": true
  29613. }
  29614. }
  29615. }
  29616. {
  29617. "389-exception": [
  29618. "389 Directory Server Exception"
  29619. ],
  29620. "Autoconf-exception-2.0": [
  29621. "Autoconf exception 2.0"
  29622. ],
  29623. "Autoconf-exception-3.0": [
  29624. "Autoconf exception 3.0"
  29625. ],
  29626. "Bison-exception-2.2": [
  29627. "Bison exception 2.2"
  29628. ],
  29629. "Bootloader-exception": [
  29630. "Bootloader Distribution Exception"
  29631. ],
  29632. "Classpath-exception-2.0": [
  29633. "Classpath exception 2.0"
  29634. ],
  29635. "CLISP-exception-2.0": [
  29636. "CLISP exception 2.0"
  29637. ],
  29638. "DigiRule-FOSS-exception": [
  29639. "DigiRule FOSS License Exception"
  29640. ],
  29641. "eCos-exception-2.0": [
  29642. "eCos exception 2.0"
  29643. ],
  29644. "Fawkes-Runtime-exception": [
  29645. "Fawkes Runtime Exception"
  29646. ],
  29647. "FLTK-exception": [
  29648. "FLTK exception"
  29649. ],
  29650. "Font-exception-2.0": [
  29651. "Font exception 2.0"
  29652. ],
  29653. "freertos-exception-2.0": [
  29654. "FreeRTOS Exception 2.0"
  29655. ],
  29656. "GCC-exception-2.0": [
  29657. "GCC Runtime Library exception 2.0"
  29658. ],
  29659. "GCC-exception-3.1": [
  29660. "GCC Runtime Library exception 3.1"
  29661. ],
  29662. "gnu-javamail-exception": [
  29663. "GNU JavaMail exception"
  29664. ],
  29665. "GPL-CC-1.0": [
  29666. "GPL Cooperation Commitment 1.0"
  29667. ],
  29668. "i2p-gpl-java-exception": [
  29669. "i2p GPL+Java Exception"
  29670. ],
  29671. "Libtool-exception": [
  29672. "Libtool Exception"
  29673. ],
  29674. "Linux-syscall-note": [
  29675. "Linux Syscall Note"
  29676. ],
  29677. "LLVM-exception": [
  29678. "LLVM Exception"
  29679. ],
  29680. "LZMA-exception": [
  29681. "LZMA exception"
  29682. ],
  29683. "mif-exception": [
  29684. "Macros and Inline Functions Exception"
  29685. ],
  29686. "Nokia-Qt-exception-1.1": [
  29687. "Nokia Qt LGPL exception 1.1"
  29688. ],
  29689. "OCaml-LGPL-linking-exception": [
  29690. "OCaml LGPL Linking Exception"
  29691. ],
  29692. "OCCT-exception-1.0": [
  29693. "Open CASCADE Exception 1.0"
  29694. ],
  29695. "OpenJDK-assembly-exception-1.0": [
  29696. "OpenJDK Assembly exception 1.0"
  29697. ],
  29698. "openvpn-openssl-exception": [
  29699. "OpenVPN OpenSSL Exception"
  29700. ],
  29701. "PS-or-PDF-font-exception-20170817": [
  29702. "PS/PDF font exception (2017-08-17)"
  29703. ],
  29704. "Qt-GPL-exception-1.0": [
  29705. "Qt GPL exception 1.0"
  29706. ],
  29707. "Qt-LGPL-exception-1.1": [
  29708. "Qt LGPL exception 1.1"
  29709. ],
  29710. "Qwt-exception-1.0": [
  29711. "Qwt exception 1.0"
  29712. ],
  29713. "Swift-exception": [
  29714. "Swift Exception"
  29715. ],
  29716. "u-boot-exception-2.0": [
  29717. "U-Boot exception 2.0"
  29718. ],
  29719. "Universal-FOSS-exception-1.0": [
  29720. "Universal FOSS Exception, Version 1.0"
  29721. ],
  29722. "WxWindows-exception-3.1": [
  29723. "WxWindows Library Exception 3.1"
  29724. ]
  29725. }{
  29726. "0BSD": [
  29727. "BSD Zero Clause License",
  29728. true,
  29729. false
  29730. ],
  29731. "AAL": [
  29732. "Attribution Assurance License",
  29733. true,
  29734. false
  29735. ],
  29736. "Abstyles": [
  29737. "Abstyles License",
  29738. false,
  29739. false
  29740. ],
  29741. "Adobe-2006": [
  29742. "Adobe Systems Incorporated Source Code License Agreement",
  29743. false,
  29744. false
  29745. ],
  29746. "Adobe-Glyph": [
  29747. "Adobe Glyph List License",
  29748. false,
  29749. false
  29750. ],
  29751. "ADSL": [
  29752. "Amazon Digital Services License",
  29753. false,
  29754. false
  29755. ],
  29756. "AFL-1.1": [
  29757. "Academic Free License v1.1",
  29758. true,
  29759. false
  29760. ],
  29761. "AFL-1.2": [
  29762. "Academic Free License v1.2",
  29763. true,
  29764. false
  29765. ],
  29766. "AFL-2.0": [
  29767. "Academic Free License v2.0",
  29768. true,
  29769. false
  29770. ],
  29771. "AFL-2.1": [
  29772. "Academic Free License v2.1",
  29773. true,
  29774. false
  29775. ],
  29776. "AFL-3.0": [
  29777. "Academic Free License v3.0",
  29778. true,
  29779. false
  29780. ],
  29781. "Afmparse": [
  29782. "Afmparse License",
  29783. false,
  29784. false
  29785. ],
  29786. "AGPL-1.0": [
  29787. "Affero General Public License v1.0",
  29788. false,
  29789. true
  29790. ],
  29791. "AGPL-1.0-only": [
  29792. "Affero General Public License v1.0 only",
  29793. false,
  29794. false
  29795. ],
  29796. "AGPL-1.0-or-later": [
  29797. "Affero General Public License v1.0 or later",
  29798. false,
  29799. false
  29800. ],
  29801. "AGPL-3.0": [
  29802. "GNU Affero General Public License v3.0",
  29803. true,
  29804. true
  29805. ],
  29806. "AGPL-3.0-only": [
  29807. "GNU Affero General Public License v3.0 only",
  29808. true,
  29809. false
  29810. ],
  29811. "AGPL-3.0-or-later": [
  29812. "GNU Affero General Public License v3.0 or later",
  29813. true,
  29814. false
  29815. ],
  29816. "Aladdin": [
  29817. "Aladdin Free Public License",
  29818. false,
  29819. false
  29820. ],
  29821. "AMDPLPA": [
  29822. "AMD's plpa_map.c License",
  29823. false,
  29824. false
  29825. ],
  29826. "AML": [
  29827. "Apple MIT License",
  29828. false,
  29829. false
  29830. ],
  29831. "AMPAS": [
  29832. "Academy of Motion Picture Arts and Sciences BSD",
  29833. false,
  29834. false
  29835. ],
  29836. "ANTLR-PD": [
  29837. "ANTLR Software Rights Notice",
  29838. false,
  29839. false
  29840. ],
  29841. "Apache-1.0": [
  29842. "Apache License 1.0",
  29843. false,
  29844. false
  29845. ],
  29846. "Apache-1.1": [
  29847. "Apache License 1.1",
  29848. true,
  29849. false
  29850. ],
  29851. "Apache-2.0": [
  29852. "Apache License 2.0",
  29853. true,
  29854. false
  29855. ],
  29856. "APAFML": [
  29857. "Adobe Postscript AFM License",
  29858. false,
  29859. false
  29860. ],
  29861. "APL-1.0": [
  29862. "Adaptive Public License 1.0",
  29863. true,
  29864. false
  29865. ],
  29866. "APSL-1.0": [
  29867. "Apple Public Source License 1.0",
  29868. true,
  29869. false
  29870. ],
  29871. "APSL-1.1": [
  29872. "Apple Public Source License 1.1",
  29873. true,
  29874. false
  29875. ],
  29876. "APSL-1.2": [
  29877. "Apple Public Source License 1.2",
  29878. true,
  29879. false
  29880. ],
  29881. "APSL-2.0": [
  29882. "Apple Public Source License 2.0",
  29883. true,
  29884. false
  29885. ],
  29886. "Artistic-1.0": [
  29887. "Artistic License 1.0",
  29888. true,
  29889. false
  29890. ],
  29891. "Artistic-1.0-cl8": [
  29892. "Artistic License 1.0 w/clause 8",
  29893. true,
  29894. false
  29895. ],
  29896. "Artistic-1.0-Perl": [
  29897. "Artistic License 1.0 (Perl)",
  29898. true,
  29899. false
  29900. ],
  29901. "Artistic-2.0": [
  29902. "Artistic License 2.0",
  29903. true,
  29904. false
  29905. ],
  29906. "Bahyph": [
  29907. "Bahyph License",
  29908. false,
  29909. false
  29910. ],
  29911. "Barr": [
  29912. "Barr License",
  29913. false,
  29914. false
  29915. ],
  29916. "Beerware": [
  29917. "Beerware License",
  29918. false,
  29919. false
  29920. ],
  29921. "BitTorrent-1.0": [
  29922. "BitTorrent Open Source License v1.0",
  29923. false,
  29924. false
  29925. ],
  29926. "BitTorrent-1.1": [
  29927. "BitTorrent Open Source License v1.1",
  29928. false,
  29929. false
  29930. ],
  29931. "blessing": [
  29932. "SQLite Blessing",
  29933. false,
  29934. false
  29935. ],
  29936. "BlueOak-1.0.0": [
  29937. "Blue Oak Model License 1.0.0",
  29938. false,
  29939. false
  29940. ],
  29941. "Borceux": [
  29942. "Borceux license",
  29943. false,
  29944. false
  29945. ],
  29946. "BSD-1-Clause": [
  29947. "BSD 1-Clause License",
  29948. false,
  29949. false
  29950. ],
  29951. "BSD-2-Clause": [
  29952. "BSD 2-Clause \"Simplified\" License",
  29953. true,
  29954. false
  29955. ],
  29956. "BSD-2-Clause-FreeBSD": [
  29957. "BSD 2-Clause FreeBSD License",
  29958. false,
  29959. false
  29960. ],
  29961. "BSD-2-Clause-NetBSD": [
  29962. "BSD 2-Clause NetBSD License",
  29963. false,
  29964. false
  29965. ],
  29966. "BSD-2-Clause-Patent": [
  29967. "BSD-2-Clause Plus Patent License",
  29968. true,
  29969. false
  29970. ],
  29971. "BSD-3-Clause": [
  29972. "BSD 3-Clause \"New\" or \"Revised\" License",
  29973. true,
  29974. false
  29975. ],
  29976. "BSD-3-Clause-Attribution": [
  29977. "BSD with attribution",
  29978. false,
  29979. false
  29980. ],
  29981. "BSD-3-Clause-Clear": [
  29982. "BSD 3-Clause Clear License",
  29983. false,
  29984. false
  29985. ],
  29986. "BSD-3-Clause-LBNL": [
  29987. "Lawrence Berkeley National Labs BSD variant license",
  29988. true,
  29989. false
  29990. ],
  29991. "BSD-3-Clause-No-Nuclear-License": [
  29992. "BSD 3-Clause No Nuclear License",
  29993. false,
  29994. false
  29995. ],
  29996. "BSD-3-Clause-No-Nuclear-License-2014": [
  29997. "BSD 3-Clause No Nuclear License 2014",
  29998. false,
  29999. false
  30000. ],
  30001. "BSD-3-Clause-No-Nuclear-Warranty": [
  30002. "BSD 3-Clause No Nuclear Warranty",
  30003. false,
  30004. false
  30005. ],
  30006. "BSD-3-Clause-Open-MPI": [
  30007. "BSD 3-Clause Open MPI variant",
  30008. false,
  30009. false
  30010. ],
  30011. "BSD-4-Clause": [
  30012. "BSD 4-Clause \"Original\" or \"Old\" License",
  30013. false,
  30014. false
  30015. ],
  30016. "BSD-4-Clause-UC": [
  30017. "BSD-4-Clause (University of California-Specific)",
  30018. false,
  30019. false
  30020. ],
  30021. "BSD-Protection": [
  30022. "BSD Protection License",
  30023. false,
  30024. false
  30025. ],
  30026. "BSD-Source-Code": [
  30027. "BSD Source Code Attribution",
  30028. false,
  30029. false
  30030. ],
  30031. "BSL-1.0": [
  30032. "Boost Software License 1.0",
  30033. true,
  30034. false
  30035. ],
  30036. "bzip2-1.0.5": [
  30037. "bzip2 and libbzip2 License v1.0.5",
  30038. false,
  30039. false
  30040. ],
  30041. "bzip2-1.0.6": [
  30042. "bzip2 and libbzip2 License v1.0.6",
  30043. false,
  30044. false
  30045. ],
  30046. "Caldera": [
  30047. "Caldera License",
  30048. false,
  30049. false
  30050. ],
  30051. "CATOSL-1.1": [
  30052. "Computer Associates Trusted Open Source License 1.1",
  30053. true,
  30054. false
  30055. ],
  30056. "CC-BY-1.0": [
  30057. "Creative Commons Attribution 1.0 Generic",
  30058. false,
  30059. false
  30060. ],
  30061. "CC-BY-2.0": [
  30062. "Creative Commons Attribution 2.0 Generic",
  30063. false,
  30064. false
  30065. ],
  30066. "CC-BY-2.5": [
  30067. "Creative Commons Attribution 2.5 Generic",
  30068. false,
  30069. false
  30070. ],
  30071. "CC-BY-3.0": [
  30072. "Creative Commons Attribution 3.0 Unported",
  30073. false,
  30074. false
  30075. ],
  30076. "CC-BY-4.0": [
  30077. "Creative Commons Attribution 4.0 International",
  30078. false,
  30079. false
  30080. ],
  30081. "CC-BY-NC-1.0": [
  30082. "Creative Commons Attribution Non Commercial 1.0 Generic",
  30083. false,
  30084. false
  30085. ],
  30086. "CC-BY-NC-2.0": [
  30087. "Creative Commons Attribution Non Commercial 2.0 Generic",
  30088. false,
  30089. false
  30090. ],
  30091. "CC-BY-NC-2.5": [
  30092. "Creative Commons Attribution Non Commercial 2.5 Generic",
  30093. false,
  30094. false
  30095. ],
  30096. "CC-BY-NC-3.0": [
  30097. "Creative Commons Attribution Non Commercial 3.0 Unported",
  30098. false,
  30099. false
  30100. ],
  30101. "CC-BY-NC-4.0": [
  30102. "Creative Commons Attribution Non Commercial 4.0 International",
  30103. false,
  30104. false
  30105. ],
  30106. "CC-BY-NC-ND-1.0": [
  30107. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  30108. false,
  30109. false
  30110. ],
  30111. "CC-BY-NC-ND-2.0": [
  30112. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  30113. false,
  30114. false
  30115. ],
  30116. "CC-BY-NC-ND-2.5": [
  30117. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  30118. false,
  30119. false
  30120. ],
  30121. "CC-BY-NC-ND-3.0": [
  30122. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  30123. false,
  30124. false
  30125. ],
  30126. "CC-BY-NC-ND-4.0": [
  30127. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  30128. false,
  30129. false
  30130. ],
  30131. "CC-BY-NC-SA-1.0": [
  30132. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  30133. false,
  30134. false
  30135. ],
  30136. "CC-BY-NC-SA-2.0": [
  30137. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  30138. false,
  30139. false
  30140. ],
  30141. "CC-BY-NC-SA-2.5": [
  30142. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  30143. false,
  30144. false
  30145. ],
  30146. "CC-BY-NC-SA-3.0": [
  30147. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  30148. false,
  30149. false
  30150. ],
  30151. "CC-BY-NC-SA-4.0": [
  30152. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  30153. false,
  30154. false
  30155. ],
  30156. "CC-BY-ND-1.0": [
  30157. "Creative Commons Attribution No Derivatives 1.0 Generic",
  30158. false,
  30159. false
  30160. ],
  30161. "CC-BY-ND-2.0": [
  30162. "Creative Commons Attribution No Derivatives 2.0 Generic",
  30163. false,
  30164. false
  30165. ],
  30166. "CC-BY-ND-2.5": [
  30167. "Creative Commons Attribution No Derivatives 2.5 Generic",
  30168. false,
  30169. false
  30170. ],
  30171. "CC-BY-ND-3.0": [
  30172. "Creative Commons Attribution No Derivatives 3.0 Unported",
  30173. false,
  30174. false
  30175. ],
  30176. "CC-BY-ND-4.0": [
  30177. "Creative Commons Attribution No Derivatives 4.0 International",
  30178. false,
  30179. false
  30180. ],
  30181. "CC-BY-SA-1.0": [
  30182. "Creative Commons Attribution Share Alike 1.0 Generic",
  30183. false,
  30184. false
  30185. ],
  30186. "CC-BY-SA-2.0": [
  30187. "Creative Commons Attribution Share Alike 2.0 Generic",
  30188. false,
  30189. false
  30190. ],
  30191. "CC-BY-SA-2.5": [
  30192. "Creative Commons Attribution Share Alike 2.5 Generic",
  30193. false,
  30194. false
  30195. ],
  30196. "CC-BY-SA-3.0": [
  30197. "Creative Commons Attribution Share Alike 3.0 Unported",
  30198. false,
  30199. false
  30200. ],
  30201. "CC-BY-SA-4.0": [
  30202. "Creative Commons Attribution Share Alike 4.0 International",
  30203. false,
  30204. false
  30205. ],
  30206. "CC-PDDC": [
  30207. "Creative Commons Public Domain Dedication and Certification",
  30208. false,
  30209. false
  30210. ],
  30211. "CC0-1.0": [
  30212. "Creative Commons Zero v1.0 Universal",
  30213. false,
  30214. false
  30215. ],
  30216. "CDDL-1.0": [
  30217. "Common Development and Distribution License 1.0",
  30218. true,
  30219. false
  30220. ],
  30221. "CDDL-1.1": [
  30222. "Common Development and Distribution License 1.1",
  30223. false,
  30224. false
  30225. ],
  30226. "CDLA-Permissive-1.0": [
  30227. "Community Data License Agreement Permissive 1.0",
  30228. false,
  30229. false
  30230. ],
  30231. "CDLA-Sharing-1.0": [
  30232. "Community Data License Agreement Sharing 1.0",
  30233. false,
  30234. false
  30235. ],
  30236. "CECILL-1.0": [
  30237. "CeCILL Free Software License Agreement v1.0",
  30238. false,
  30239. false
  30240. ],
  30241. "CECILL-1.1": [
  30242. "CeCILL Free Software License Agreement v1.1",
  30243. false,
  30244. false
  30245. ],
  30246. "CECILL-2.0": [
  30247. "CeCILL Free Software License Agreement v2.0",
  30248. false,
  30249. false
  30250. ],
  30251. "CECILL-2.1": [
  30252. "CeCILL Free Software License Agreement v2.1",
  30253. true,
  30254. false
  30255. ],
  30256. "CECILL-B": [
  30257. "CeCILL-B Free Software License Agreement",
  30258. false,
  30259. false
  30260. ],
  30261. "CECILL-C": [
  30262. "CeCILL-C Free Software License Agreement",
  30263. false,
  30264. false
  30265. ],
  30266. "CERN-OHL-1.1": [
  30267. "CERN Open Hardware License v1.1",
  30268. false,
  30269. false
  30270. ],
  30271. "CERN-OHL-1.2": [
  30272. "CERN Open Hardware Licence v1.2",
  30273. false,
  30274. false
  30275. ],
  30276. "ClArtistic": [
  30277. "Clarified Artistic License",
  30278. false,
  30279. false
  30280. ],
  30281. "CNRI-Jython": [
  30282. "CNRI Jython License",
  30283. false,
  30284. false
  30285. ],
  30286. "CNRI-Python": [
  30287. "CNRI Python License",
  30288. true,
  30289. false
  30290. ],
  30291. "CNRI-Python-GPL-Compatible": [
  30292. "CNRI Python Open Source GPL Compatible License Agreement",
  30293. false,
  30294. false
  30295. ],
  30296. "Condor-1.1": [
  30297. "Condor Public License v1.1",
  30298. false,
  30299. false
  30300. ],
  30301. "copyleft-next-0.3.0": [
  30302. "copyleft-next 0.3.0",
  30303. false,
  30304. false
  30305. ],
  30306. "copyleft-next-0.3.1": [
  30307. "copyleft-next 0.3.1",
  30308. false,
  30309. false
  30310. ],
  30311. "CPAL-1.0": [
  30312. "Common Public Attribution License 1.0",
  30313. true,
  30314. false
  30315. ],
  30316. "CPL-1.0": [
  30317. "Common Public License 1.0",
  30318. true,
  30319. false
  30320. ],
  30321. "CPOL-1.02": [
  30322. "Code Project Open License 1.02",
  30323. false,
  30324. false
  30325. ],
  30326. "Crossword": [
  30327. "Crossword License",
  30328. false,
  30329. false
  30330. ],
  30331. "CrystalStacker": [
  30332. "CrystalStacker License",
  30333. false,
  30334. false
  30335. ],
  30336. "CUA-OPL-1.0": [
  30337. "CUA Office Public License v1.0",
  30338. true,
  30339. false
  30340. ],
  30341. "Cube": [
  30342. "Cube License",
  30343. false,
  30344. false
  30345. ],
  30346. "curl": [
  30347. "curl License",
  30348. false,
  30349. false
  30350. ],
  30351. "D-FSL-1.0": [
  30352. "Deutsche Freie Software Lizenz",
  30353. false,
  30354. false
  30355. ],
  30356. "diffmark": [
  30357. "diffmark license",
  30358. false,
  30359. false
  30360. ],
  30361. "DOC": [
  30362. "DOC License",
  30363. false,
  30364. false
  30365. ],
  30366. "Dotseqn": [
  30367. "Dotseqn License",
  30368. false,
  30369. false
  30370. ],
  30371. "DSDP": [
  30372. "DSDP License",
  30373. false,
  30374. false
  30375. ],
  30376. "dvipdfm": [
  30377. "dvipdfm License",
  30378. false,
  30379. false
  30380. ],
  30381. "ECL-1.0": [
  30382. "Educational Community License v1.0",
  30383. true,
  30384. false
  30385. ],
  30386. "ECL-2.0": [
  30387. "Educational Community License v2.0",
  30388. true,
  30389. false
  30390. ],
  30391. "eCos-2.0": [
  30392. "eCos license version 2.0",
  30393. false,
  30394. true
  30395. ],
  30396. "EFL-1.0": [
  30397. "Eiffel Forum License v1.0",
  30398. true,
  30399. false
  30400. ],
  30401. "EFL-2.0": [
  30402. "Eiffel Forum License v2.0",
  30403. true,
  30404. false
  30405. ],
  30406. "eGenix": [
  30407. "eGenix.com Public License 1.1.0",
  30408. false,
  30409. false
  30410. ],
  30411. "Entessa": [
  30412. "Entessa Public License v1.0",
  30413. true,
  30414. false
  30415. ],
  30416. "EPL-1.0": [
  30417. "Eclipse Public License 1.0",
  30418. true,
  30419. false
  30420. ],
  30421. "EPL-2.0": [
  30422. "Eclipse Public License 2.0",
  30423. true,
  30424. false
  30425. ],
  30426. "ErlPL-1.1": [
  30427. "Erlang Public License v1.1",
  30428. false,
  30429. false
  30430. ],
  30431. "EUDatagrid": [
  30432. "EU DataGrid Software License",
  30433. true,
  30434. false
  30435. ],
  30436. "EUPL-1.0": [
  30437. "European Union Public License 1.0",
  30438. false,
  30439. false
  30440. ],
  30441. "EUPL-1.1": [
  30442. "European Union Public License 1.1",
  30443. true,
  30444. false
  30445. ],
  30446. "EUPL-1.2": [
  30447. "European Union Public License 1.2",
  30448. true,
  30449. false
  30450. ],
  30451. "Eurosym": [
  30452. "Eurosym License",
  30453. false,
  30454. false
  30455. ],
  30456. "Fair": [
  30457. "Fair License",
  30458. true,
  30459. false
  30460. ],
  30461. "Frameworx-1.0": [
  30462. "Frameworx Open License 1.0",
  30463. true,
  30464. false
  30465. ],
  30466. "FreeImage": [
  30467. "FreeImage Public License v1.0",
  30468. false,
  30469. false
  30470. ],
  30471. "FSFAP": [
  30472. "FSF All Permissive License",
  30473. false,
  30474. false
  30475. ],
  30476. "FSFUL": [
  30477. "FSF Unlimited License",
  30478. false,
  30479. false
  30480. ],
  30481. "FSFULLR": [
  30482. "FSF Unlimited License (with License Retention)",
  30483. false,
  30484. false
  30485. ],
  30486. "FTL": [
  30487. "Freetype Project License",
  30488. false,
  30489. false
  30490. ],
  30491. "GFDL-1.1": [
  30492. "GNU Free Documentation License v1.1",
  30493. false,
  30494. true
  30495. ],
  30496. "GFDL-1.1-only": [
  30497. "GNU Free Documentation License v1.1 only",
  30498. false,
  30499. false
  30500. ],
  30501. "GFDL-1.1-or-later": [
  30502. "GNU Free Documentation License v1.1 or later",
  30503. false,
  30504. false
  30505. ],
  30506. "GFDL-1.2": [
  30507. "GNU Free Documentation License v1.2",
  30508. false,
  30509. true
  30510. ],
  30511. "GFDL-1.2-only": [
  30512. "GNU Free Documentation License v1.2 only",
  30513. false,
  30514. false
  30515. ],
  30516. "GFDL-1.2-or-later": [
  30517. "GNU Free Documentation License v1.2 or later",
  30518. false,
  30519. false
  30520. ],
  30521. "GFDL-1.3": [
  30522. "GNU Free Documentation License v1.3",
  30523. false,
  30524. true
  30525. ],
  30526. "GFDL-1.3-only": [
  30527. "GNU Free Documentation License v1.3 only",
  30528. false,
  30529. false
  30530. ],
  30531. "GFDL-1.3-or-later": [
  30532. "GNU Free Documentation License v1.3 or later",
  30533. false,
  30534. false
  30535. ],
  30536. "Giftware": [
  30537. "Giftware License",
  30538. false,
  30539. false
  30540. ],
  30541. "GL2PS": [
  30542. "GL2PS License",
  30543. false,
  30544. false
  30545. ],
  30546. "Glide": [
  30547. "3dfx Glide License",
  30548. false,
  30549. false
  30550. ],
  30551. "Glulxe": [
  30552. "Glulxe License",
  30553. false,
  30554. false
  30555. ],
  30556. "gnuplot": [
  30557. "gnuplot License",
  30558. false,
  30559. false
  30560. ],
  30561. "GPL-1.0": [
  30562. "GNU General Public License v1.0 only",
  30563. false,
  30564. true
  30565. ],
  30566. "GPL-1.0+": [
  30567. "GNU General Public License v1.0 or later",
  30568. false,
  30569. true
  30570. ],
  30571. "GPL-1.0-only": [
  30572. "GNU General Public License v1.0 only",
  30573. false,
  30574. false
  30575. ],
  30576. "GPL-1.0-or-later": [
  30577. "GNU General Public License v1.0 or later",
  30578. false,
  30579. false
  30580. ],
  30581. "GPL-2.0": [
  30582. "GNU General Public License v2.0 only",
  30583. true,
  30584. true
  30585. ],
  30586. "GPL-2.0+": [
  30587. "GNU General Public License v2.0 or later",
  30588. true,
  30589. true
  30590. ],
  30591. "GPL-2.0-only": [
  30592. "GNU General Public License v2.0 only",
  30593. true,
  30594. false
  30595. ],
  30596. "GPL-2.0-or-later": [
  30597. "GNU General Public License v2.0 or later",
  30598. true,
  30599. false
  30600. ],
  30601. "GPL-2.0-with-autoconf-exception": [
  30602. "GNU General Public License v2.0 w/Autoconf exception",
  30603. false,
  30604. true
  30605. ],
  30606. "GPL-2.0-with-bison-exception": [
  30607. "GNU General Public License v2.0 w/Bison exception",
  30608. false,
  30609. true
  30610. ],
  30611. "GPL-2.0-with-classpath-exception": [
  30612. "GNU General Public License v2.0 w/Classpath exception",
  30613. false,
  30614. true
  30615. ],
  30616. "GPL-2.0-with-font-exception": [
  30617. "GNU General Public License v2.0 w/Font exception",
  30618. false,
  30619. true
  30620. ],
  30621. "GPL-2.0-with-GCC-exception": [
  30622. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  30623. false,
  30624. true
  30625. ],
  30626. "GPL-3.0": [
  30627. "GNU General Public License v3.0 only",
  30628. true,
  30629. true
  30630. ],
  30631. "GPL-3.0+": [
  30632. "GNU General Public License v3.0 or later",
  30633. true,
  30634. true
  30635. ],
  30636. "GPL-3.0-only": [
  30637. "GNU General Public License v3.0 only",
  30638. true,
  30639. false
  30640. ],
  30641. "GPL-3.0-or-later": [
  30642. "GNU General Public License v3.0 or later",
  30643. true,
  30644. false
  30645. ],
  30646. "GPL-3.0-with-autoconf-exception": [
  30647. "GNU General Public License v3.0 w/Autoconf exception",
  30648. false,
  30649. true
  30650. ],
  30651. "GPL-3.0-with-GCC-exception": [
  30652. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  30653. true,
  30654. true
  30655. ],
  30656. "gSOAP-1.3b": [
  30657. "gSOAP Public License v1.3b",
  30658. false,
  30659. false
  30660. ],
  30661. "HaskellReport": [
  30662. "Haskell Language Report License",
  30663. false,
  30664. false
  30665. ],
  30666. "HPND": [
  30667. "Historical Permission Notice and Disclaimer",
  30668. true,
  30669. false
  30670. ],
  30671. "HPND-sell-variant": [
  30672. "Historical Permission Notice and Disclaimer - sell variant",
  30673. false,
  30674. false
  30675. ],
  30676. "IBM-pibs": [
  30677. "IBM PowerPC Initialization and Boot Software",
  30678. false,
  30679. false
  30680. ],
  30681. "ICU": [
  30682. "ICU License",
  30683. false,
  30684. false
  30685. ],
  30686. "IJG": [
  30687. "Independent JPEG Group License",
  30688. false,
  30689. false
  30690. ],
  30691. "ImageMagick": [
  30692. "ImageMagick License",
  30693. false,
  30694. false
  30695. ],
  30696. "iMatix": [
  30697. "iMatix Standard Function Library Agreement",
  30698. false,
  30699. false
  30700. ],
  30701. "Imlib2": [
  30702. "Imlib2 License",
  30703. false,
  30704. false
  30705. ],
  30706. "Info-ZIP": [
  30707. "Info-ZIP License",
  30708. false,
  30709. false
  30710. ],
  30711. "Intel": [
  30712. "Intel Open Source License",
  30713. true,
  30714. false
  30715. ],
  30716. "Intel-ACPI": [
  30717. "Intel ACPI Software License Agreement",
  30718. false,
  30719. false
  30720. ],
  30721. "Interbase-1.0": [
  30722. "Interbase Public License v1.0",
  30723. false,
  30724. false
  30725. ],
  30726. "IPA": [
  30727. "IPA Font License",
  30728. true,
  30729. false
  30730. ],
  30731. "IPL-1.0": [
  30732. "IBM Public License v1.0",
  30733. true,
  30734. false
  30735. ],
  30736. "ISC": [
  30737. "ISC License",
  30738. true,
  30739. false
  30740. ],
  30741. "JasPer-2.0": [
  30742. "JasPer License",
  30743. false,
  30744. false
  30745. ],
  30746. "JPNIC": [
  30747. "Japan Network Information Center License",
  30748. false,
  30749. false
  30750. ],
  30751. "JSON": [
  30752. "JSON License",
  30753. false,
  30754. false
  30755. ],
  30756. "LAL-1.2": [
  30757. "Licence Art Libre 1.2",
  30758. false,
  30759. false
  30760. ],
  30761. "LAL-1.3": [
  30762. "Licence Art Libre 1.3",
  30763. false,
  30764. false
  30765. ],
  30766. "Latex2e": [
  30767. "Latex2e License",
  30768. false,
  30769. false
  30770. ],
  30771. "Leptonica": [
  30772. "Leptonica License",
  30773. false,
  30774. false
  30775. ],
  30776. "LGPL-2.0": [
  30777. "GNU Library General Public License v2 only",
  30778. true,
  30779. true
  30780. ],
  30781. "LGPL-2.0+": [
  30782. "GNU Library General Public License v2 or later",
  30783. true,
  30784. true
  30785. ],
  30786. "LGPL-2.0-only": [
  30787. "GNU Library General Public License v2 only",
  30788. true,
  30789. false
  30790. ],
  30791. "LGPL-2.0-or-later": [
  30792. "GNU Library General Public License v2 or later",
  30793. true,
  30794. false
  30795. ],
  30796. "LGPL-2.1": [
  30797. "GNU Lesser General Public License v2.1 only",
  30798. true,
  30799. true
  30800. ],
  30801. "LGPL-2.1+": [
  30802. "GNU Library General Public License v2.1 or later",
  30803. true,
  30804. true
  30805. ],
  30806. "LGPL-2.1-only": [
  30807. "GNU Lesser General Public License v2.1 only",
  30808. true,
  30809. false
  30810. ],
  30811. "LGPL-2.1-or-later": [
  30812. "GNU Lesser General Public License v2.1 or later",
  30813. true,
  30814. false
  30815. ],
  30816. "LGPL-3.0": [
  30817. "GNU Lesser General Public License v3.0 only",
  30818. true,
  30819. true
  30820. ],
  30821. "LGPL-3.0+": [
  30822. "GNU Lesser General Public License v3.0 or later",
  30823. true,
  30824. true
  30825. ],
  30826. "LGPL-3.0-only": [
  30827. "GNU Lesser General Public License v3.0 only",
  30828. true,
  30829. false
  30830. ],
  30831. "LGPL-3.0-or-later": [
  30832. "GNU Lesser General Public License v3.0 or later",
  30833. true,
  30834. false
  30835. ],
  30836. "LGPLLR": [
  30837. "Lesser General Public License For Linguistic Resources",
  30838. false,
  30839. false
  30840. ],
  30841. "Libpng": [
  30842. "libpng License",
  30843. false,
  30844. false
  30845. ],
  30846. "libpng-2.0": [
  30847. "PNG Reference Library version 2",
  30848. false,
  30849. false
  30850. ],
  30851. "libtiff": [
  30852. "libtiff License",
  30853. false,
  30854. false
  30855. ],
  30856. "LiLiQ-P-1.1": [
  30857. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30858. true,
  30859. false
  30860. ],
  30861. "LiLiQ-R-1.1": [
  30862. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30863. true,
  30864. false
  30865. ],
  30866. "LiLiQ-Rplus-1.1": [
  30867. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30868. true,
  30869. false
  30870. ],
  30871. "Linux-OpenIB": [
  30872. "Linux Kernel Variant of OpenIB.org license",
  30873. false,
  30874. false
  30875. ],
  30876. "LPL-1.0": [
  30877. "Lucent Public License Version 1.0",
  30878. true,
  30879. false
  30880. ],
  30881. "LPL-1.02": [
  30882. "Lucent Public License v1.02",
  30883. true,
  30884. false
  30885. ],
  30886. "LPPL-1.0": [
  30887. "LaTeX Project Public License v1.0",
  30888. false,
  30889. false
  30890. ],
  30891. "LPPL-1.1": [
  30892. "LaTeX Project Public License v1.1",
  30893. false,
  30894. false
  30895. ],
  30896. "LPPL-1.2": [
  30897. "LaTeX Project Public License v1.2",
  30898. false,
  30899. false
  30900. ],
  30901. "LPPL-1.3a": [
  30902. "LaTeX Project Public License v1.3a",
  30903. false,
  30904. false
  30905. ],
  30906. "LPPL-1.3c": [
  30907. "LaTeX Project Public License v1.3c",
  30908. true,
  30909. false
  30910. ],
  30911. "MakeIndex": [
  30912. "MakeIndex License",
  30913. false,
  30914. false
  30915. ],
  30916. "MirOS": [
  30917. "MirOS License",
  30918. true,
  30919. false
  30920. ],
  30921. "MIT": [
  30922. "MIT License",
  30923. true,
  30924. false
  30925. ],
  30926. "MIT-0": [
  30927. "MIT No Attribution",
  30928. true,
  30929. false
  30930. ],
  30931. "MIT-advertising": [
  30932. "Enlightenment License (e16)",
  30933. false,
  30934. false
  30935. ],
  30936. "MIT-CMU": [
  30937. "CMU License",
  30938. false,
  30939. false
  30940. ],
  30941. "MIT-enna": [
  30942. "enna License",
  30943. false,
  30944. false
  30945. ],
  30946. "MIT-feh": [
  30947. "feh License",
  30948. false,
  30949. false
  30950. ],
  30951. "MITNFA": [
  30952. "MIT +no-false-attribs license",
  30953. false,
  30954. false
  30955. ],
  30956. "Motosoto": [
  30957. "Motosoto License",
  30958. true,
  30959. false
  30960. ],
  30961. "mpich2": [
  30962. "mpich2 License",
  30963. false,
  30964. false
  30965. ],
  30966. "MPL-1.0": [
  30967. "Mozilla Public License 1.0",
  30968. true,
  30969. false
  30970. ],
  30971. "MPL-1.1": [
  30972. "Mozilla Public License 1.1",
  30973. true,
  30974. false
  30975. ],
  30976. "MPL-2.0": [
  30977. "Mozilla Public License 2.0",
  30978. true,
  30979. false
  30980. ],
  30981. "MPL-2.0-no-copyleft-exception": [
  30982. "Mozilla Public License 2.0 (no copyleft exception)",
  30983. true,
  30984. false
  30985. ],
  30986. "MS-PL": [
  30987. "Microsoft Public License",
  30988. true,
  30989. false
  30990. ],
  30991. "MS-RL": [
  30992. "Microsoft Reciprocal License",
  30993. true,
  30994. false
  30995. ],
  30996. "MTLL": [
  30997. "Matrix Template Library License",
  30998. false,
  30999. false
  31000. ],
  31001. "Multics": [
  31002. "Multics License",
  31003. true,
  31004. false
  31005. ],
  31006. "Mup": [
  31007. "Mup License",
  31008. false,
  31009. false
  31010. ],
  31011. "NASA-1.3": [
  31012. "NASA Open Source Agreement 1.3",
  31013. true,
  31014. false
  31015. ],
  31016. "Naumen": [
  31017. "Naumen Public License",
  31018. true,
  31019. false
  31020. ],
  31021. "NBPL-1.0": [
  31022. "Net Boolean Public License v1",
  31023. false,
  31024. false
  31025. ],
  31026. "NCSA": [
  31027. "University of Illinois/NCSA Open Source License",
  31028. true,
  31029. false
  31030. ],
  31031. "Net-SNMP": [
  31032. "Net-SNMP License",
  31033. false,
  31034. false
  31035. ],
  31036. "NetCDF": [
  31037. "NetCDF license",
  31038. false,
  31039. false
  31040. ],
  31041. "Newsletr": [
  31042. "Newsletr License",
  31043. false,
  31044. false
  31045. ],
  31046. "NGPL": [
  31047. "Nethack General Public License",
  31048. true,
  31049. false
  31050. ],
  31051. "NLOD-1.0": [
  31052. "Norwegian Licence for Open Government Data",
  31053. false,
  31054. false
  31055. ],
  31056. "NLPL": [
  31057. "No Limit Public License",
  31058. false,
  31059. false
  31060. ],
  31061. "Nokia": [
  31062. "Nokia Open Source License",
  31063. true,
  31064. false
  31065. ],
  31066. "NOSL": [
  31067. "Netizen Open Source License",
  31068. false,
  31069. false
  31070. ],
  31071. "Noweb": [
  31072. "Noweb License",
  31073. false,
  31074. false
  31075. ],
  31076. "NPL-1.0": [
  31077. "Netscape Public License v1.0",
  31078. false,
  31079. false
  31080. ],
  31081. "NPL-1.1": [
  31082. "Netscape Public License v1.1",
  31083. false,
  31084. false
  31085. ],
  31086. "NPOSL-3.0": [
  31087. "Non-Profit Open Software License 3.0",
  31088. true,
  31089. false
  31090. ],
  31091. "NRL": [
  31092. "NRL License",
  31093. false,
  31094. false
  31095. ],
  31096. "NTP": [
  31097. "NTP License",
  31098. true,
  31099. false
  31100. ],
  31101. "Nunit": [
  31102. "Nunit License",
  31103. false,
  31104. true
  31105. ],
  31106. "OCCT-PL": [
  31107. "Open CASCADE Technology Public License",
  31108. false,
  31109. false
  31110. ],
  31111. "OCLC-2.0": [
  31112. "OCLC Research Public License 2.0",
  31113. true,
  31114. false
  31115. ],
  31116. "ODbL-1.0": [
  31117. "ODC Open Database License v1.0",
  31118. false,
  31119. false
  31120. ],
  31121. "ODC-By-1.0": [
  31122. "Open Data Commons Attribution License v1.0",
  31123. false,
  31124. false
  31125. ],
  31126. "OFL-1.0": [
  31127. "SIL Open Font License 1.0",
  31128. false,
  31129. false
  31130. ],
  31131. "OFL-1.1": [
  31132. "SIL Open Font License 1.1",
  31133. true,
  31134. false
  31135. ],
  31136. "OGL-UK-1.0": [
  31137. "Open Government Licence v1.0",
  31138. false,
  31139. false
  31140. ],
  31141. "OGL-UK-2.0": [
  31142. "Open Government Licence v2.0",
  31143. false,
  31144. false
  31145. ],
  31146. "OGL-UK-3.0": [
  31147. "Open Government Licence v3.0",
  31148. false,
  31149. false
  31150. ],
  31151. "OGTSL": [
  31152. "Open Group Test Suite License",
  31153. true,
  31154. false
  31155. ],
  31156. "OLDAP-1.1": [
  31157. "Open LDAP Public License v1.1",
  31158. false,
  31159. false
  31160. ],
  31161. "OLDAP-1.2": [
  31162. "Open LDAP Public License v1.2",
  31163. false,
  31164. false
  31165. ],
  31166. "OLDAP-1.3": [
  31167. "Open LDAP Public License v1.3",
  31168. false,
  31169. false
  31170. ],
  31171. "OLDAP-1.4": [
  31172. "Open LDAP Public License v1.4",
  31173. false,
  31174. false
  31175. ],
  31176. "OLDAP-2.0": [
  31177. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  31178. false,
  31179. false
  31180. ],
  31181. "OLDAP-2.0.1": [
  31182. "Open LDAP Public License v2.0.1",
  31183. false,
  31184. false
  31185. ],
  31186. "OLDAP-2.1": [
  31187. "Open LDAP Public License v2.1",
  31188. false,
  31189. false
  31190. ],
  31191. "OLDAP-2.2": [
  31192. "Open LDAP Public License v2.2",
  31193. false,
  31194. false
  31195. ],
  31196. "OLDAP-2.2.1": [
  31197. "Open LDAP Public License v2.2.1",
  31198. false,
  31199. false
  31200. ],
  31201. "OLDAP-2.2.2": [
  31202. "Open LDAP Public License 2.2.2",
  31203. false,
  31204. false
  31205. ],
  31206. "OLDAP-2.3": [
  31207. "Open LDAP Public License v2.3",
  31208. false,
  31209. false
  31210. ],
  31211. "OLDAP-2.4": [
  31212. "Open LDAP Public License v2.4",
  31213. false,
  31214. false
  31215. ],
  31216. "OLDAP-2.5": [
  31217. "Open LDAP Public License v2.5",
  31218. false,
  31219. false
  31220. ],
  31221. "OLDAP-2.6": [
  31222. "Open LDAP Public License v2.6",
  31223. false,
  31224. false
  31225. ],
  31226. "OLDAP-2.7": [
  31227. "Open LDAP Public License v2.7",
  31228. false,
  31229. false
  31230. ],
  31231. "OLDAP-2.8": [
  31232. "Open LDAP Public License v2.8",
  31233. false,
  31234. false
  31235. ],
  31236. "OML": [
  31237. "Open Market License",
  31238. false,
  31239. false
  31240. ],
  31241. "OpenSSL": [
  31242. "OpenSSL License",
  31243. false,
  31244. false
  31245. ],
  31246. "OPL-1.0": [
  31247. "Open Public License v1.0",
  31248. false,
  31249. false
  31250. ],
  31251. "OSET-PL-2.1": [
  31252. "OSET Public License version 2.1",
  31253. true,
  31254. false
  31255. ],
  31256. "OSL-1.0": [
  31257. "Open Software License 1.0",
  31258. true,
  31259. false
  31260. ],
  31261. "OSL-1.1": [
  31262. "Open Software License 1.1",
  31263. false,
  31264. false
  31265. ],
  31266. "OSL-2.0": [
  31267. "Open Software License 2.0",
  31268. true,
  31269. false
  31270. ],
  31271. "OSL-2.1": [
  31272. "Open Software License 2.1",
  31273. true,
  31274. false
  31275. ],
  31276. "OSL-3.0": [
  31277. "Open Software License 3.0",
  31278. true,
  31279. false
  31280. ],
  31281. "Parity-6.0.0": [
  31282. "The Parity Public License 6.0.0",
  31283. false,
  31284. false
  31285. ],
  31286. "PDDL-1.0": [
  31287. "ODC Public Domain Dedication & License 1.0",
  31288. false,
  31289. false
  31290. ],
  31291. "PHP-3.0": [
  31292. "PHP License v3.0",
  31293. true,
  31294. false
  31295. ],
  31296. "PHP-3.01": [
  31297. "PHP License v3.01",
  31298. false,
  31299. false
  31300. ],
  31301. "Plexus": [
  31302. "Plexus Classworlds License",
  31303. false,
  31304. false
  31305. ],
  31306. "PostgreSQL": [
  31307. "PostgreSQL License",
  31308. true,
  31309. false
  31310. ],
  31311. "psfrag": [
  31312. "psfrag License",
  31313. false,
  31314. false
  31315. ],
  31316. "psutils": [
  31317. "psutils License",
  31318. false,
  31319. false
  31320. ],
  31321. "Python-2.0": [
  31322. "Python License 2.0",
  31323. true,
  31324. false
  31325. ],
  31326. "Qhull": [
  31327. "Qhull License",
  31328. false,
  31329. false
  31330. ],
  31331. "QPL-1.0": [
  31332. "Q Public License 1.0",
  31333. true,
  31334. false
  31335. ],
  31336. "Rdisc": [
  31337. "Rdisc License",
  31338. false,
  31339. false
  31340. ],
  31341. "RHeCos-1.1": [
  31342. "Red Hat eCos Public License v1.1",
  31343. false,
  31344. false
  31345. ],
  31346. "RPL-1.1": [
  31347. "Reciprocal Public License 1.1",
  31348. true,
  31349. false
  31350. ],
  31351. "RPL-1.5": [
  31352. "Reciprocal Public License 1.5",
  31353. true,
  31354. false
  31355. ],
  31356. "RPSL-1.0": [
  31357. "RealNetworks Public Source License v1.0",
  31358. true,
  31359. false
  31360. ],
  31361. "RSA-MD": [
  31362. "RSA Message-Digest License",
  31363. false,
  31364. false
  31365. ],
  31366. "RSCPL": [
  31367. "Ricoh Source Code Public License",
  31368. true,
  31369. false
  31370. ],
  31371. "Ruby": [
  31372. "Ruby License",
  31373. false,
  31374. false
  31375. ],
  31376. "SAX-PD": [
  31377. "Sax Public Domain Notice",
  31378. false,
  31379. false
  31380. ],
  31381. "Saxpath": [
  31382. "Saxpath License",
  31383. false,
  31384. false
  31385. ],
  31386. "SCEA": [
  31387. "SCEA Shared Source License",
  31388. false,
  31389. false
  31390. ],
  31391. "Sendmail": [
  31392. "Sendmail License",
  31393. false,
  31394. false
  31395. ],
  31396. "Sendmail-8.23": [
  31397. "Sendmail License 8.23",
  31398. false,
  31399. false
  31400. ],
  31401. "SGI-B-1.0": [
  31402. "SGI Free Software License B v1.0",
  31403. false,
  31404. false
  31405. ],
  31406. "SGI-B-1.1": [
  31407. "SGI Free Software License B v1.1",
  31408. false,
  31409. false
  31410. ],
  31411. "SGI-B-2.0": [
  31412. "SGI Free Software License B v2.0",
  31413. false,
  31414. false
  31415. ],
  31416. "SHL-0.5": [
  31417. "Solderpad Hardware License v0.5",
  31418. false,
  31419. false
  31420. ],
  31421. "SHL-0.51": [
  31422. "Solderpad Hardware License, Version 0.51",
  31423. false,
  31424. false
  31425. ],
  31426. "SimPL-2.0": [
  31427. "Simple Public License 2.0",
  31428. true,
  31429. false
  31430. ],
  31431. "SISSL": [
  31432. "Sun Industry Standards Source License v1.1",
  31433. true,
  31434. false
  31435. ],
  31436. "SISSL-1.2": [
  31437. "Sun Industry Standards Source License v1.2",
  31438. false,
  31439. false
  31440. ],
  31441. "Sleepycat": [
  31442. "Sleepycat License",
  31443. true,
  31444. false
  31445. ],
  31446. "SMLNJ": [
  31447. "Standard ML of New Jersey License",
  31448. false,
  31449. false
  31450. ],
  31451. "SMPPL": [
  31452. "Secure Messaging Protocol Public License",
  31453. false,
  31454. false
  31455. ],
  31456. "SNIA": [
  31457. "SNIA Public License 1.1",
  31458. false,
  31459. false
  31460. ],
  31461. "Spencer-86": [
  31462. "Spencer License 86",
  31463. false,
  31464. false
  31465. ],
  31466. "Spencer-94": [
  31467. "Spencer License 94",
  31468. false,
  31469. false
  31470. ],
  31471. "Spencer-99": [
  31472. "Spencer License 99",
  31473. false,
  31474. false
  31475. ],
  31476. "SPL-1.0": [
  31477. "Sun Public License v1.0",
  31478. true,
  31479. false
  31480. ],
  31481. "SSPL-1.0": [
  31482. "Server Side Public License, v 1",
  31483. false,
  31484. false
  31485. ],
  31486. "StandardML-NJ": [
  31487. "Standard ML of New Jersey License",
  31488. false,
  31489. true
  31490. ],
  31491. "SugarCRM-1.1.3": [
  31492. "SugarCRM Public License v1.1.3",
  31493. false,
  31494. false
  31495. ],
  31496. "SWL": [
  31497. "Scheme Widget Library (SWL) Software License Agreement",
  31498. false,
  31499. false
  31500. ],
  31501. "TAPR-OHL-1.0": [
  31502. "TAPR Open Hardware License v1.0",
  31503. false,
  31504. false
  31505. ],
  31506. "TCL": [
  31507. "TCL/TK License",
  31508. false,
  31509. false
  31510. ],
  31511. "TCP-wrappers": [
  31512. "TCP Wrappers License",
  31513. false,
  31514. false
  31515. ],
  31516. "TMate": [
  31517. "TMate Open Source License",
  31518. false,
  31519. false
  31520. ],
  31521. "TORQUE-1.1": [
  31522. "TORQUE v2.5+ Software License v1.1",
  31523. false,
  31524. false
  31525. ],
  31526. "TOSL": [
  31527. "Trusster Open Source License",
  31528. false,
  31529. false
  31530. ],
  31531. "TU-Berlin-1.0": [
  31532. "Technische Universitaet Berlin License 1.0",
  31533. false,
  31534. false
  31535. ],
  31536. "TU-Berlin-2.0": [
  31537. "Technische Universitaet Berlin License 2.0",
  31538. false,
  31539. false
  31540. ],
  31541. "Unicode-DFS-2015": [
  31542. "Unicode License Agreement - Data Files and Software (2015)",
  31543. false,
  31544. false
  31545. ],
  31546. "Unicode-DFS-2016": [
  31547. "Unicode License Agreement - Data Files and Software (2016)",
  31548. false,
  31549. false
  31550. ],
  31551. "Unicode-TOU": [
  31552. "Unicode Terms of Use",
  31553. false,
  31554. false
  31555. ],
  31556. "Unlicense": [
  31557. "The Unlicense",
  31558. false,
  31559. false
  31560. ],
  31561. "UPL-1.0": [
  31562. "Universal Permissive License v1.0",
  31563. true,
  31564. false
  31565. ],
  31566. "Vim": [
  31567. "Vim License",
  31568. false,
  31569. false
  31570. ],
  31571. "VOSTROM": [
  31572. "VOSTROM Public License for Open Source",
  31573. false,
  31574. false
  31575. ],
  31576. "VSL-1.0": [
  31577. "Vovida Software License v1.0",
  31578. true,
  31579. false
  31580. ],
  31581. "W3C": [
  31582. "W3C Software Notice and License (2002-12-31)",
  31583. true,
  31584. false
  31585. ],
  31586. "W3C-19980720": [
  31587. "W3C Software Notice and License (1998-07-20)",
  31588. false,
  31589. false
  31590. ],
  31591. "W3C-20150513": [
  31592. "W3C Software Notice and Document License (2015-05-13)",
  31593. false,
  31594. false
  31595. ],
  31596. "Watcom-1.0": [
  31597. "Sybase Open Watcom Public License 1.0",
  31598. true,
  31599. false
  31600. ],
  31601. "Wsuipa": [
  31602. "Wsuipa License",
  31603. false,
  31604. false
  31605. ],
  31606. "WTFPL": [
  31607. "Do What The F*ck You Want To Public License",
  31608. false,
  31609. false
  31610. ],
  31611. "wxWindows": [
  31612. "wxWindows Library License",
  31613. false,
  31614. true
  31615. ],
  31616. "X11": [
  31617. "X11 License",
  31618. false,
  31619. false
  31620. ],
  31621. "Xerox": [
  31622. "Xerox License",
  31623. false,
  31624. false
  31625. ],
  31626. "XFree86-1.1": [
  31627. "XFree86 License 1.1",
  31628. false,
  31629. false
  31630. ],
  31631. "xinetd": [
  31632. "xinetd License",
  31633. false,
  31634. false
  31635. ],
  31636. "Xnet": [
  31637. "X.Net License",
  31638. true,
  31639. false
  31640. ],
  31641. "xpp": [
  31642. "XPP License",
  31643. false,
  31644. false
  31645. ],
  31646. "XSkat": [
  31647. "XSkat License",
  31648. false,
  31649. false
  31650. ],
  31651. "YPL-1.0": [
  31652. "Yahoo! Public License v1.0",
  31653. false,
  31654. false
  31655. ],
  31656. "YPL-1.1": [
  31657. "Yahoo! Public License v1.1",
  31658. false,
  31659. false
  31660. ],
  31661. "Zed": [
  31662. "Zed License",
  31663. false,
  31664. false
  31665. ],
  31666. "Zend-2.0": [
  31667. "Zend License v2.0",
  31668. false,
  31669. false
  31670. ],
  31671. "Zimbra-1.3": [
  31672. "Zimbra Public License v1.3",
  31673. false,
  31674. false
  31675. ],
  31676. "Zimbra-1.4": [
  31677. "Zimbra Public License v1.4",
  31678. false,
  31679. false
  31680. ],
  31681. "Zlib": [
  31682. "zlib License",
  31683. true,
  31684. false
  31685. ],
  31686. "zlib-acknowledgement": [
  31687. "zlib/libpng License with Acknowledgement",
  31688. false,
  31689. false
  31690. ],
  31691. "ZPL-1.1": [
  31692. "Zope Public License 1.1",
  31693. false,
  31694. false
  31695. ],
  31696. "ZPL-2.0": [
  31697. "Zope Public License 2.0",
  31698. true,
  31699. false
  31700. ],
  31701. "ZPL-2.1": [
  31702. "Zope Public License 2.1",
  31703. false,
  31704. false
  31705. ]
  31706. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  31707. $�������Æ,Í;§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��������à�  ��
  31708. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  31709. ����������������� ��`.rdata����� ���
  31710. �����������������@��@.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
  31711. 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
  31712. 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
  31713. 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">
  31714. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  31715. <security>
  31716. <requestedPrivileges>
  31717. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  31718. </requestedPrivileges>
  31719. </security>
  31720. </trustInfo>
  31721. <dependency>
  31722. <dependentAssembly>
  31723. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  31724. </dependentAssembly>
  31725. </dependency>
  31726. </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
  31727. namespace Symfony\Component\Console;
  31728. use Symfony\Component\Console\Command\Command;
  31729. use Symfony\Component\Console\Command\HelpCommand;
  31730. use Symfony\Component\Console\Command\ListCommand;
  31731. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31732. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31733. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  31734. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  31735. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  31736. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31737. use Symfony\Component\Console\Exception\ExceptionInterface;
  31738. use Symfony\Component\Console\Exception\LogicException;
  31739. use Symfony\Component\Console\Formatter\OutputFormatter;
  31740. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  31741. use Symfony\Component\Console\Helper\DialogHelper;
  31742. use Symfony\Component\Console\Helper\FormatterHelper;
  31743. use Symfony\Component\Console\Helper\Helper;
  31744. use Symfony\Component\Console\Helper\HelperSet;
  31745. use Symfony\Component\Console\Helper\ProcessHelper;
  31746. use Symfony\Component\Console\Helper\ProgressHelper;
  31747. use Symfony\Component\Console\Helper\QuestionHelper;
  31748. use Symfony\Component\Console\Helper\TableHelper;
  31749. use Symfony\Component\Console\Input\ArgvInput;
  31750. use Symfony\Component\Console\Input\ArrayInput;
  31751. use Symfony\Component\Console\Input\InputArgument;
  31752. use Symfony\Component\Console\Input\InputAwareInterface;
  31753. use Symfony\Component\Console\Input\InputDefinition;
  31754. use Symfony\Component\Console\Input\InputInterface;
  31755. use Symfony\Component\Console\Input\InputOption;
  31756. use Symfony\Component\Console\Output\BufferedOutput;
  31757. use Symfony\Component\Console\Output\ConsoleOutput;
  31758. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31759. use Symfony\Component\Console\Output\OutputInterface;
  31760. use Symfony\Component\Debug\Exception\FatalThrowableError;
  31761. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  31762. class Application
  31763. {
  31764. private $commands = array();
  31765. private $wantHelps = false;
  31766. private $runningCommand;
  31767. private $name;
  31768. private $version;
  31769. private $catchExceptions = true;
  31770. private $autoExit = true;
  31771. private $definition;
  31772. private $helperSet;
  31773. private $dispatcher;
  31774. private $terminalDimensions;
  31775. private $defaultCommand;
  31776. private $initialized;
  31777. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  31778. {
  31779. $this->name = $name;
  31780. $this->version = $version;
  31781. $this->defaultCommand = 'list';
  31782. }
  31783. public function setDispatcher(EventDispatcherInterface $dispatcher)
  31784. {
  31785. $this->dispatcher = $dispatcher;
  31786. }
  31787. public function run(InputInterface $input = null, OutputInterface $output = null)
  31788. {
  31789. if (null === $input) {
  31790. $input = new ArgvInput();
  31791. }
  31792. if (null === $output) {
  31793. $output = new ConsoleOutput();
  31794. }
  31795. $this->configureIO($input, $output);
  31796. try {
  31797. $e = null;
  31798. $exitCode = $this->doRun($input, $output);
  31799. } catch (\Exception $e) {
  31800. }
  31801. if (null !== $e) {
  31802. if (!$this->catchExceptions) {
  31803. throw $e;
  31804. }
  31805. if ($output instanceof ConsoleOutputInterface) {
  31806. $this->renderException($e, $output->getErrorOutput());
  31807. } else {
  31808. $this->renderException($e, $output);
  31809. }
  31810. $exitCode = $this->getExitCodeForThrowable($e);
  31811. }
  31812. if ($this->autoExit) {
  31813. if ($exitCode > 255) {
  31814. $exitCode = 255;
  31815. }
  31816. exit($exitCode);
  31817. }
  31818. return $exitCode;
  31819. }
  31820. public function doRun(InputInterface $input, OutputInterface $output)
  31821. {
  31822. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  31823. $output->writeln($this->getLongVersion());
  31824. return 0;
  31825. }
  31826. $name = $this->getCommandName($input);
  31827. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  31828. if (!$name) {
  31829. $name = 'help';
  31830. $input = new ArrayInput(array('command' => 'help'));
  31831. } else {
  31832. $this->wantHelps = true;
  31833. }
  31834. }
  31835. if (!$name) {
  31836. $name = $this->defaultCommand;
  31837. $definition = $this->getDefinition();
  31838. $definition->setArguments(array_merge(
  31839. $definition->getArguments(),
  31840. array(
  31841. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  31842. )
  31843. ));
  31844. }
  31845. $this->runningCommand = null;
  31846. $command = $this->find($name);
  31847. $this->runningCommand = $command;
  31848. $exitCode = $this->doRunCommand($command, $input, $output);
  31849. $this->runningCommand = null;
  31850. return $exitCode;
  31851. }
  31852. public function setHelperSet(HelperSet $helperSet)
  31853. {
  31854. $this->helperSet = $helperSet;
  31855. }
  31856. public function getHelperSet()
  31857. {
  31858. if (!$this->helperSet) {
  31859. $this->helperSet = $this->getDefaultHelperSet();
  31860. }
  31861. return $this->helperSet;
  31862. }
  31863. public function setDefinition(InputDefinition $definition)
  31864. {
  31865. $this->definition = $definition;
  31866. }
  31867. public function getDefinition()
  31868. {
  31869. if (!$this->definition) {
  31870. $this->definition = $this->getDefaultInputDefinition();
  31871. }
  31872. return $this->definition;
  31873. }
  31874. public function getHelp()
  31875. {
  31876. return $this->getLongVersion();
  31877. }
  31878. public function setCatchExceptions($boolean)
  31879. {
  31880. $this->catchExceptions = (bool) $boolean;
  31881. }
  31882. public function setAutoExit($boolean)
  31883. {
  31884. $this->autoExit = (bool) $boolean;
  31885. }
  31886. public function getName()
  31887. {
  31888. return $this->name;
  31889. }
  31890. public function setName($name)
  31891. {
  31892. $this->name = $name;
  31893. }
  31894. public function getVersion()
  31895. {
  31896. return $this->version;
  31897. }
  31898. public function setVersion($version)
  31899. {
  31900. $this->version = $version;
  31901. }
  31902. public function getLongVersion()
  31903. {
  31904. if ('UNKNOWN' !== $this->getName()) {
  31905. if ('UNKNOWN' !== $this->getVersion()) {
  31906. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31907. }
  31908. return sprintf('<info>%s</info>', $this->getName());
  31909. }
  31910. return '<info>Console Tool</info>';
  31911. }
  31912. public function register($name)
  31913. {
  31914. return $this->add(new Command($name));
  31915. }
  31916. public function addCommands(array $commands)
  31917. {
  31918. foreach ($commands as $command) {
  31919. $this->add($command);
  31920. }
  31921. }
  31922. public function add(Command $command)
  31923. {
  31924. $this->init();
  31925. $command->setApplication($this);
  31926. if (!$command->isEnabled()) {
  31927. $command->setApplication(null);
  31928. return;
  31929. }
  31930. if (null === $command->getDefinition()) {
  31931. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  31932. }
  31933. $this->commands[$command->getName()] = $command;
  31934. foreach ($command->getAliases() as $alias) {
  31935. $this->commands[$alias] = $command;
  31936. }
  31937. return $command;
  31938. }
  31939. public function get($name)
  31940. {
  31941. $this->init();
  31942. if (!isset($this->commands[$name])) {
  31943. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  31944. }
  31945. $command = $this->commands[$name];
  31946. if ($this->wantHelps) {
  31947. $this->wantHelps = false;
  31948. $helpCommand = $this->get('help');
  31949. $helpCommand->setCommand($command);
  31950. return $helpCommand;
  31951. }
  31952. return $command;
  31953. }
  31954. public function has($name)
  31955. {
  31956. $this->init();
  31957. return isset($this->commands[$name]);
  31958. }
  31959. public function getNamespaces()
  31960. {
  31961. $namespaces = array();
  31962. foreach ($this->all() as $command) {
  31963. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  31964. foreach ($command->getAliases() as $alias) {
  31965. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  31966. }
  31967. }
  31968. return array_values(array_unique(array_filter($namespaces)));
  31969. }
  31970. public function findNamespace($namespace)
  31971. {
  31972. $allNamespaces = $this->getNamespaces();
  31973. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  31974. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  31975. if (empty($namespaces)) {
  31976. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  31977. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  31978. if (1 == \count($alternatives)) {
  31979. $message .= "\n\nDid you mean this?\n ";
  31980. } else {
  31981. $message .= "\n\nDid you mean one of these?\n ";
  31982. }
  31983. $message .= implode("\n ", $alternatives);
  31984. }
  31985. throw new CommandNotFoundException($message, $alternatives);
  31986. }
  31987. $exact = \in_array($namespace, $namespaces, true);
  31988. if (\count($namespaces) > 1 && !$exact) {
  31989. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  31990. }
  31991. return $exact ? $namespace : reset($namespaces);
  31992. }
  31993. public function find($name)
  31994. {
  31995. $this->init();
  31996. $aliases = array();
  31997. $allCommands = array_keys($this->commands);
  31998. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  31999. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  32000. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  32001. if (false !== $pos = strrpos($name, ':')) {
  32002. $this->findNamespace(substr($name, 0, $pos));
  32003. }
  32004. $message = sprintf('Command "%s" is not defined.', $name);
  32005. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  32006. if (1 == \count($alternatives)) {
  32007. $message .= "\n\nDid you mean this?\n ";
  32008. } else {
  32009. $message .= "\n\nDid you mean one of these?\n ";
  32010. }
  32011. $message .= implode("\n ", $alternatives);
  32012. }
  32013. throw new CommandNotFoundException($message, $alternatives);
  32014. }
  32015. if (\count($commands) > 1) {
  32016. $commandList = $this->commands;
  32017. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  32018. $commandName = $commandList[$nameOrAlias]->getName();
  32019. $aliases[$nameOrAlias] = $commandName;
  32020. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  32021. });
  32022. }
  32023. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  32024. if (!$exact && \count($commands) > 1) {
  32025. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  32026. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  32027. }
  32028. return $this->get($exact ? $name : reset($commands));
  32029. }
  32030. public function all($namespace = null)
  32031. {
  32032. $this->init();
  32033. if (null === $namespace) {
  32034. return $this->commands;
  32035. }
  32036. $commands = array();
  32037. foreach ($this->commands as $name => $command) {
  32038. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  32039. $commands[$name] = $command;
  32040. }
  32041. }
  32042. return $commands;
  32043. }
  32044. public static function getAbbreviations($names)
  32045. {
  32046. $abbrevs = array();
  32047. foreach ($names as $name) {
  32048. for ($len = \strlen($name); $len > 0; --$len) {
  32049. $abbrev = substr($name, 0, $len);
  32050. $abbrevs[$abbrev][] = $name;
  32051. }
  32052. }
  32053. return $abbrevs;
  32054. }
  32055. public function asText($namespace = null, $raw = false)
  32056. {
  32057. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32058. $descriptor = new TextDescriptor();
  32059. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  32060. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  32061. return $output->fetch();
  32062. }
  32063. public function asXml($namespace = null, $asDom = false)
  32064. {
  32065. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32066. $descriptor = new XmlDescriptor();
  32067. if ($asDom) {
  32068. return $descriptor->getApplicationDocument($this, $namespace);
  32069. }
  32070. $output = new BufferedOutput();
  32071. $descriptor->describe($output, $this, array('namespace' => $namespace));
  32072. return $output->fetch();
  32073. }
  32074. public function renderException($e, $output)
  32075. {
  32076. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32077. do {
  32078. $title = sprintf(' [%s] ', \get_class($e));
  32079. $len = Helper::strlen($title);
  32080. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  32081. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  32082. $width = 1 << 31;
  32083. }
  32084. $lines = array();
  32085. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  32086. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  32087. $lineLength = Helper::strlen($line) + 4;
  32088. $lines[] = array($line, $lineLength);
  32089. $len = max($lineLength, $len);
  32090. }
  32091. }
  32092. $messages = array();
  32093. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  32094. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  32095. foreach ($lines as $line) {
  32096. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  32097. }
  32098. $messages[] = $emptyLine;
  32099. $messages[] = '';
  32100. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  32101. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  32102. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  32103. $trace = $e->getTrace();
  32104. array_unshift($trace, array(
  32105. 'function' => '',
  32106. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  32107. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  32108. 'args' => array(),
  32109. ));
  32110. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  32111. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  32112. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  32113. $function = $trace[$i]['function'];
  32114. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  32115. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  32116. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  32117. }
  32118. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32119. }
  32120. } while ($e = $e->getPrevious());
  32121. if (null !== $this->runningCommand) {
  32122. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  32123. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32124. }
  32125. }
  32126. protected function getTerminalWidth()
  32127. {
  32128. $dimensions = $this->getTerminalDimensions();
  32129. return $dimensions[0];
  32130. }
  32131. protected function getTerminalHeight()
  32132. {
  32133. $dimensions = $this->getTerminalDimensions();
  32134. return $dimensions[1];
  32135. }
  32136. public function getTerminalDimensions()
  32137. {
  32138. if ($this->terminalDimensions) {
  32139. return $this->terminalDimensions;
  32140. }
  32141. if ('\\' === \DIRECTORY_SEPARATOR) {
  32142. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  32143. return array((int) $matches[1], (int) $matches[2]);
  32144. }
  32145. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  32146. return array((int) $matches[1], (int) $matches[2]);
  32147. }
  32148. }
  32149. if ($sttyString = $this->getSttyColumns()) {
  32150. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  32151. return array((int) $matches[2], (int) $matches[1]);
  32152. }
  32153. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  32154. return array((int) $matches[2], (int) $matches[1]);
  32155. }
  32156. }
  32157. return array(null, null);
  32158. }
  32159. public function setTerminalDimensions($width, $height)
  32160. {
  32161. $this->terminalDimensions = array($width, $height);
  32162. return $this;
  32163. }
  32164. protected function configureIO(InputInterface $input, OutputInterface $output)
  32165. {
  32166. if (true === $input->hasParameterOption(array('--ansi'))) {
  32167. $output->setDecorated(true);
  32168. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  32169. $output->setDecorated(false);
  32170. }
  32171. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  32172. $input->setInteractive(false);
  32173. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  32174. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  32175. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  32176. $input->setInteractive(false);
  32177. }
  32178. }
  32179. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  32180. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  32181. $input->setInteractive(false);
  32182. } else {
  32183. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  32184. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  32185. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  32186. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  32187. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  32188. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  32189. }
  32190. }
  32191. }
  32192. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  32193. {
  32194. foreach ($command->getHelperSet() as $helper) {
  32195. if ($helper instanceof InputAwareInterface) {
  32196. $helper->setInput($input);
  32197. }
  32198. }
  32199. if (null === $this->dispatcher) {
  32200. return $command->run($input, $output);
  32201. }
  32202. try {
  32203. $command->mergeApplicationDefinition();
  32204. $input->bind($command->getDefinition());
  32205. } catch (ExceptionInterface $e) {
  32206. }
  32207. $event = new ConsoleCommandEvent($command, $input, $output);
  32208. $e = null;
  32209. try {
  32210. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  32211. if ($event->commandShouldRun()) {
  32212. $exitCode = $command->run($input, $output);
  32213. } else {
  32214. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  32215. }
  32216. } catch (\Exception $e) {
  32217. } catch (\Throwable $e) {
  32218. }
  32219. if (null !== $e) {
  32220. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  32221. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  32222. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  32223. if ($x !== $event->getException()) {
  32224. $e = $event->getException();
  32225. }
  32226. $exitCode = $this->getExitCodeForThrowable($e);
  32227. }
  32228. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  32229. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  32230. if (null !== $e) {
  32231. throw $e;
  32232. }
  32233. return $event->getExitCode();
  32234. }
  32235. protected function getCommandName(InputInterface $input)
  32236. {
  32237. return $input->getFirstArgument();
  32238. }
  32239. protected function getDefaultInputDefinition()
  32240. {
  32241. return new InputDefinition(array(
  32242. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  32243. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  32244. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  32245. 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'),
  32246. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  32247. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  32248. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  32249. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  32250. ));
  32251. }
  32252. protected function getDefaultCommands()
  32253. {
  32254. return array(new HelpCommand(), new ListCommand());
  32255. }
  32256. protected function getDefaultHelperSet()
  32257. {
  32258. return new HelperSet(array(
  32259. new FormatterHelper(),
  32260. new DialogHelper(false),
  32261. new ProgressHelper(false),
  32262. new TableHelper(false),
  32263. new DebugFormatterHelper(),
  32264. new ProcessHelper(),
  32265. new QuestionHelper(),
  32266. ));
  32267. }
  32268. private function getSttyColumns()
  32269. {
  32270. if (!\function_exists('proc_open')) {
  32271. return;
  32272. }
  32273. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32274. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32275. if (\is_resource($process)) {
  32276. $info = stream_get_contents($pipes[1]);
  32277. fclose($pipes[1]);
  32278. fclose($pipes[2]);
  32279. proc_close($process);
  32280. return $info;
  32281. }
  32282. }
  32283. private function getConsoleMode()
  32284. {
  32285. if (!\function_exists('proc_open')) {
  32286. return;
  32287. }
  32288. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32289. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32290. if (\is_resource($process)) {
  32291. $info = stream_get_contents($pipes[1]);
  32292. fclose($pipes[1]);
  32293. fclose($pipes[2]);
  32294. proc_close($process);
  32295. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  32296. return $matches[2].'x'.$matches[1];
  32297. }
  32298. }
  32299. }
  32300. private function getAbbreviationSuggestions($abbrevs)
  32301. {
  32302. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  32303. }
  32304. public function extractNamespace($name, $limit = null)
  32305. {
  32306. $parts = explode(':', $name);
  32307. array_pop($parts);
  32308. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  32309. }
  32310. private function findAlternatives($name, $collection)
  32311. {
  32312. $threshold = 1e3;
  32313. $alternatives = array();
  32314. $collectionParts = array();
  32315. foreach ($collection as $item) {
  32316. $collectionParts[$item] = explode(':', $item);
  32317. }
  32318. foreach (explode(':', $name) as $i => $subname) {
  32319. foreach ($collectionParts as $collectionName => $parts) {
  32320. $exists = isset($alternatives[$collectionName]);
  32321. if (!isset($parts[$i]) && $exists) {
  32322. $alternatives[$collectionName] += $threshold;
  32323. continue;
  32324. } elseif (!isset($parts[$i])) {
  32325. continue;
  32326. }
  32327. $lev = levenshtein($subname, $parts[$i]);
  32328. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  32329. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  32330. } elseif ($exists) {
  32331. $alternatives[$collectionName] += $threshold;
  32332. }
  32333. }
  32334. }
  32335. foreach ($collection as $item) {
  32336. $lev = levenshtein($name, $item);
  32337. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  32338. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  32339. }
  32340. }
  32341. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  32342. asort($alternatives);
  32343. return array_keys($alternatives);
  32344. }
  32345. public function setDefaultCommand($commandName)
  32346. {
  32347. $this->defaultCommand = $commandName;
  32348. }
  32349. private function splitStringByWidth($string, $width)
  32350. {
  32351. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  32352. return str_split($string, $width);
  32353. }
  32354. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  32355. $lines = array();
  32356. $line = '';
  32357. foreach (preg_split('//u', $utf8String) as $char) {
  32358. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  32359. $line .= $char;
  32360. continue;
  32361. }
  32362. $lines[] = str_pad($line, $width);
  32363. $line = $char;
  32364. }
  32365. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  32366. mb_convert_variables($encoding, 'utf8', $lines);
  32367. return $lines;
  32368. }
  32369. private function extractAllNamespaces($name)
  32370. {
  32371. $parts = explode(':', $name, -1);
  32372. $namespaces = array();
  32373. foreach ($parts as $part) {
  32374. if (\count($namespaces)) {
  32375. $namespaces[] = end($namespaces).':'.$part;
  32376. } else {
  32377. $namespaces[] = $part;
  32378. }
  32379. }
  32380. return $namespaces;
  32381. }
  32382. private function init()
  32383. {
  32384. if ($this->initialized) {
  32385. return;
  32386. }
  32387. $this->initialized = true;
  32388. foreach ($this->getDefaultCommands() as $command) {
  32389. $this->add($command);
  32390. }
  32391. }
  32392. private function getExitCodeForThrowable($throwable)
  32393. {
  32394. $exitCode = $throwable->getCode();
  32395. if (is_numeric($exitCode)) {
  32396. $exitCode = (int) $exitCode;
  32397. if (0 === $exitCode) {
  32398. $exitCode = 1;
  32399. }
  32400. } else {
  32401. $exitCode = 1;
  32402. }
  32403. return $exitCode;
  32404. }
  32405. }
  32406. <?php
  32407. namespace Symfony\Component\Console\Command;
  32408. use Symfony\Component\Console\Application;
  32409. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32410. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32411. use Symfony\Component\Console\Exception\ExceptionInterface;
  32412. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32413. use Symfony\Component\Console\Exception\LogicException;
  32414. use Symfony\Component\Console\Helper\HelperSet;
  32415. use Symfony\Component\Console\Input\InputArgument;
  32416. use Symfony\Component\Console\Input\InputDefinition;
  32417. use Symfony\Component\Console\Input\InputInterface;
  32418. use Symfony\Component\Console\Input\InputOption;
  32419. use Symfony\Component\Console\Output\BufferedOutput;
  32420. use Symfony\Component\Console\Output\OutputInterface;
  32421. class Command
  32422. {
  32423. private $application;
  32424. private $name;
  32425. private $processTitle;
  32426. private $aliases = array();
  32427. private $definition;
  32428. private $help;
  32429. private $description;
  32430. private $ignoreValidationErrors = false;
  32431. private $applicationDefinitionMerged = false;
  32432. private $applicationDefinitionMergedWithArgs = false;
  32433. private $code;
  32434. private $synopsis = array();
  32435. private $usages = array();
  32436. private $helperSet;
  32437. public function __construct($name = null)
  32438. {
  32439. $this->definition = new InputDefinition();
  32440. if (null !== $name) {
  32441. $this->setName($name);
  32442. }
  32443. $this->configure();
  32444. if (!$this->name) {
  32445. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  32446. }
  32447. }
  32448. public function ignoreValidationErrors()
  32449. {
  32450. $this->ignoreValidationErrors = true;
  32451. }
  32452. public function setApplication(Application $application = null)
  32453. {
  32454. $this->application = $application;
  32455. if ($application) {
  32456. $this->setHelperSet($application->getHelperSet());
  32457. } else {
  32458. $this->helperSet = null;
  32459. }
  32460. }
  32461. public function setHelperSet(HelperSet $helperSet)
  32462. {
  32463. $this->helperSet = $helperSet;
  32464. }
  32465. public function getHelperSet()
  32466. {
  32467. return $this->helperSet;
  32468. }
  32469. public function getApplication()
  32470. {
  32471. return $this->application;
  32472. }
  32473. public function isEnabled()
  32474. {
  32475. return true;
  32476. }
  32477. protected function configure()
  32478. {
  32479. }
  32480. protected function execute(InputInterface $input, OutputInterface $output)
  32481. {
  32482. throw new LogicException('You must override the execute() method in the concrete command class.');
  32483. }
  32484. protected function interact(InputInterface $input, OutputInterface $output)
  32485. {
  32486. }
  32487. protected function initialize(InputInterface $input, OutputInterface $output)
  32488. {
  32489. }
  32490. public function run(InputInterface $input, OutputInterface $output)
  32491. {
  32492. $this->getSynopsis(true);
  32493. $this->getSynopsis(false);
  32494. $this->mergeApplicationDefinition();
  32495. try {
  32496. $input->bind($this->definition);
  32497. } catch (ExceptionInterface $e) {
  32498. if (!$this->ignoreValidationErrors) {
  32499. throw $e;
  32500. }
  32501. }
  32502. $this->initialize($input, $output);
  32503. if (null !== $this->processTitle) {
  32504. if (\function_exists('cli_set_process_title')) {
  32505. if (!@cli_set_process_title($this->processTitle)) {
  32506. if ('Darwin' === PHP_OS) {
  32507. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  32508. } else {
  32509. cli_set_process_title($this->processTitle);
  32510. }
  32511. }
  32512. } elseif (\function_exists('setproctitle')) {
  32513. setproctitle($this->processTitle);
  32514. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  32515. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  32516. }
  32517. }
  32518. if ($input->isInteractive()) {
  32519. $this->interact($input, $output);
  32520. }
  32521. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  32522. $input->setArgument('command', $this->getName());
  32523. }
  32524. $input->validate();
  32525. if ($this->code) {
  32526. $statusCode = \call_user_func($this->code, $input, $output);
  32527. } else {
  32528. $statusCode = $this->execute($input, $output);
  32529. }
  32530. return is_numeric($statusCode) ? (int) $statusCode : 0;
  32531. }
  32532. public function setCode($code)
  32533. {
  32534. if (!\is_callable($code)) {
  32535. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  32536. }
  32537. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  32538. $r = new \ReflectionFunction($code);
  32539. if (null === $r->getClosureThis()) {
  32540. if (\PHP_VERSION_ID < 70000) {
  32541. $code = @\Closure::bind($code, $this);
  32542. } else {
  32543. $code = \Closure::bind($code, $this);
  32544. }
  32545. }
  32546. }
  32547. $this->code = $code;
  32548. return $this;
  32549. }
  32550. public function mergeApplicationDefinition($mergeArgs = true)
  32551. {
  32552. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  32553. return;
  32554. }
  32555. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  32556. $this->applicationDefinitionMerged = true;
  32557. if ($mergeArgs) {
  32558. $currentArguments = $this->definition->getArguments();
  32559. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  32560. $this->definition->addArguments($currentArguments);
  32561. $this->applicationDefinitionMergedWithArgs = true;
  32562. }
  32563. }
  32564. public function setDefinition($definition)
  32565. {
  32566. if ($definition instanceof InputDefinition) {
  32567. $this->definition = $definition;
  32568. } else {
  32569. $this->definition->setDefinition($definition);
  32570. }
  32571. $this->applicationDefinitionMerged = false;
  32572. return $this;
  32573. }
  32574. public function getDefinition()
  32575. {
  32576. return $this->definition;
  32577. }
  32578. public function getNativeDefinition()
  32579. {
  32580. return $this->getDefinition();
  32581. }
  32582. public function addArgument($name, $mode = null, $description = '', $default = null)
  32583. {
  32584. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  32585. return $this;
  32586. }
  32587. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32588. {
  32589. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  32590. return $this;
  32591. }
  32592. public function setName($name)
  32593. {
  32594. $this->validateName($name);
  32595. $this->name = $name;
  32596. return $this;
  32597. }
  32598. public function setProcessTitle($title)
  32599. {
  32600. $this->processTitle = $title;
  32601. return $this;
  32602. }
  32603. public function getName()
  32604. {
  32605. return $this->name;
  32606. }
  32607. public function setDescription($description)
  32608. {
  32609. $this->description = $description;
  32610. return $this;
  32611. }
  32612. public function getDescription()
  32613. {
  32614. return $this->description;
  32615. }
  32616. public function setHelp($help)
  32617. {
  32618. $this->help = $help;
  32619. return $this;
  32620. }
  32621. public function getHelp()
  32622. {
  32623. return $this->help;
  32624. }
  32625. public function getProcessedHelp()
  32626. {
  32627. $name = $this->name;
  32628. $placeholders = array(
  32629. '%command.name%',
  32630. '%command.full_name%',
  32631. );
  32632. $replacements = array(
  32633. $name,
  32634. $_SERVER['PHP_SELF'].' '.$name,
  32635. );
  32636. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  32637. }
  32638. public function setAliases($aliases)
  32639. {
  32640. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  32641. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  32642. }
  32643. foreach ($aliases as $alias) {
  32644. $this->validateName($alias);
  32645. }
  32646. $this->aliases = $aliases;
  32647. return $this;
  32648. }
  32649. public function getAliases()
  32650. {
  32651. return $this->aliases;
  32652. }
  32653. public function getSynopsis($short = false)
  32654. {
  32655. $key = $short ? 'short' : 'long';
  32656. if (!isset($this->synopsis[$key])) {
  32657. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  32658. }
  32659. return $this->synopsis[$key];
  32660. }
  32661. public function addUsage($usage)
  32662. {
  32663. if (0 !== strpos($usage, $this->name)) {
  32664. $usage = sprintf('%s %s', $this->name, $usage);
  32665. }
  32666. $this->usages[] = $usage;
  32667. return $this;
  32668. }
  32669. public function getUsages()
  32670. {
  32671. return $this->usages;
  32672. }
  32673. public function getHelper($name)
  32674. {
  32675. if (null === $this->helperSet) {
  32676. 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));
  32677. }
  32678. return $this->helperSet->get($name);
  32679. }
  32680. public function asText()
  32681. {
  32682. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32683. $descriptor = new TextDescriptor();
  32684. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32685. $descriptor->describe($output, $this, array('raw_output' => true));
  32686. return $output->fetch();
  32687. }
  32688. public function asXml($asDom = false)
  32689. {
  32690. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32691. $descriptor = new XmlDescriptor();
  32692. if ($asDom) {
  32693. return $descriptor->getCommandDocument($this);
  32694. }
  32695. $output = new BufferedOutput();
  32696. $descriptor->describe($output, $this);
  32697. return $output->fetch();
  32698. }
  32699. private function validateName($name)
  32700. {
  32701. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  32702. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  32703. }
  32704. }
  32705. }
  32706. <?php
  32707. namespace Symfony\Component\Console\Command;
  32708. use Symfony\Component\Console\Helper\DescriptorHelper;
  32709. use Symfony\Component\Console\Input\InputArgument;
  32710. use Symfony\Component\Console\Input\InputInterface;
  32711. use Symfony\Component\Console\Input\InputOption;
  32712. use Symfony\Component\Console\Output\OutputInterface;
  32713. class HelpCommand extends Command
  32714. {
  32715. private $command;
  32716. protected function configure()
  32717. {
  32718. $this->ignoreValidationErrors();
  32719. $this
  32720. ->setName('help')
  32721. ->setDefinition(array(
  32722. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  32723. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  32724. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32725. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  32726. ))
  32727. ->setDescription('Displays help for a command')
  32728. ->setHelp(<<<'EOF'
  32729. The <info>%command.name%</info> command displays help for a given command:
  32730. <info>php %command.full_name% list</info>
  32731. You can also output the help in other formats by using the <comment>--format</comment> option:
  32732. <info>php %command.full_name% --format=xml list</info>
  32733. To display the list of available commands, please use the <info>list</info> command.
  32734. EOF
  32735. )
  32736. ;
  32737. }
  32738. public function setCommand(Command $command)
  32739. {
  32740. $this->command = $command;
  32741. }
  32742. protected function execute(InputInterface $input, OutputInterface $output)
  32743. {
  32744. if (null === $this->command) {
  32745. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  32746. }
  32747. if ($input->getOption('xml')) {
  32748. @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);
  32749. $input->setOption('format', 'xml');
  32750. }
  32751. $helper = new DescriptorHelper();
  32752. $helper->describe($output, $this->command, array(
  32753. 'format' => $input->getOption('format'),
  32754. 'raw_text' => $input->getOption('raw'),
  32755. ));
  32756. $this->command = null;
  32757. }
  32758. }
  32759. <?php
  32760. namespace Symfony\Component\Console\Command;
  32761. use Symfony\Component\Console\Helper\DescriptorHelper;
  32762. use Symfony\Component\Console\Input\InputArgument;
  32763. use Symfony\Component\Console\Input\InputDefinition;
  32764. use Symfony\Component\Console\Input\InputInterface;
  32765. use Symfony\Component\Console\Input\InputOption;
  32766. use Symfony\Component\Console\Output\OutputInterface;
  32767. class ListCommand extends Command
  32768. {
  32769. protected function configure()
  32770. {
  32771. $this
  32772. ->setName('list')
  32773. ->setDefinition($this->createDefinition())
  32774. ->setDescription('Lists commands')
  32775. ->setHelp(<<<'EOF'
  32776. The <info>%command.name%</info> command lists all commands:
  32777. <info>php %command.full_name%</info>
  32778. You can also display the commands for a specific namespace:
  32779. <info>php %command.full_name% test</info>
  32780. You can also output the information in other formats by using the <comment>--format</comment> option:
  32781. <info>php %command.full_name% --format=xml</info>
  32782. It's also possible to get raw list of commands (useful for embedding command runner):
  32783. <info>php %command.full_name% --raw</info>
  32784. EOF
  32785. )
  32786. ;
  32787. }
  32788. public function getNativeDefinition()
  32789. {
  32790. return $this->createDefinition();
  32791. }
  32792. protected function execute(InputInterface $input, OutputInterface $output)
  32793. {
  32794. if ($input->getOption('xml')) {
  32795. @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);
  32796. $input->setOption('format', 'xml');
  32797. }
  32798. $helper = new DescriptorHelper();
  32799. $helper->describe($output, $this->getApplication(), array(
  32800. 'format' => $input->getOption('format'),
  32801. 'raw_text' => $input->getOption('raw'),
  32802. 'namespace' => $input->getArgument('namespace'),
  32803. ));
  32804. }
  32805. private function createDefinition()
  32806. {
  32807. return new InputDefinition(array(
  32808. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  32809. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  32810. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  32811. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32812. ));
  32813. }
  32814. }
  32815. <?php
  32816. namespace Symfony\Component\Console;
  32817. final class ConsoleEvents
  32818. {
  32819. const COMMAND = 'console.command';
  32820. const TERMINATE = 'console.terminate';
  32821. const EXCEPTION = 'console.exception';
  32822. }
  32823. <?php
  32824. namespace Symfony\Component\Console\Descriptor;
  32825. use Symfony\Component\Console\Application;
  32826. use Symfony\Component\Console\Command\Command;
  32827. use Symfony\Component\Console\Exception\CommandNotFoundException;
  32828. class ApplicationDescription
  32829. {
  32830. const GLOBAL_NAMESPACE = '_global';
  32831. private $application;
  32832. private $namespace;
  32833. private $namespaces;
  32834. private $commands;
  32835. private $aliases;
  32836. public function __construct(Application $application, $namespace = null)
  32837. {
  32838. $this->application = $application;
  32839. $this->namespace = $namespace;
  32840. }
  32841. public function getNamespaces()
  32842. {
  32843. if (null === $this->namespaces) {
  32844. $this->inspectApplication();
  32845. }
  32846. return $this->namespaces;
  32847. }
  32848. public function getCommands()
  32849. {
  32850. if (null === $this->commands) {
  32851. $this->inspectApplication();
  32852. }
  32853. return $this->commands;
  32854. }
  32855. public function getCommand($name)
  32856. {
  32857. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  32858. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  32859. }
  32860. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  32861. }
  32862. private function inspectApplication()
  32863. {
  32864. $this->commands = array();
  32865. $this->namespaces = array();
  32866. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  32867. foreach ($this->sortCommands($all) as $namespace => $commands) {
  32868. $names = array();
  32869. foreach ($commands as $name => $command) {
  32870. if (!$command->getName()) {
  32871. continue;
  32872. }
  32873. if ($command->getName() === $name) {
  32874. $this->commands[$name] = $command;
  32875. } else {
  32876. $this->aliases[$name] = $command;
  32877. }
  32878. $names[] = $name;
  32879. }
  32880. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  32881. }
  32882. }
  32883. private function sortCommands(array $commands)
  32884. {
  32885. $namespacedCommands = array();
  32886. $globalCommands = array();
  32887. foreach ($commands as $name => $command) {
  32888. $key = $this->application->extractNamespace($name, 1);
  32889. if (!$key) {
  32890. $globalCommands['_global'][$name] = $command;
  32891. } else {
  32892. $namespacedCommands[$key][$name] = $command;
  32893. }
  32894. }
  32895. ksort($namespacedCommands);
  32896. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  32897. foreach ($namespacedCommands as &$commandsSet) {
  32898. ksort($commandsSet);
  32899. }
  32900. unset($commandsSet);
  32901. return $namespacedCommands;
  32902. }
  32903. }
  32904. <?php
  32905. namespace Symfony\Component\Console\Descriptor;
  32906. use Symfony\Component\Console\Application;
  32907. use Symfony\Component\Console\Command\Command;
  32908. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32909. use Symfony\Component\Console\Input\InputArgument;
  32910. use Symfony\Component\Console\Input\InputDefinition;
  32911. use Symfony\Component\Console\Input\InputOption;
  32912. use Symfony\Component\Console\Output\OutputInterface;
  32913. abstract class Descriptor implements DescriptorInterface
  32914. {
  32915. private $output;
  32916. public function describe(OutputInterface $output, $object, array $options = array())
  32917. {
  32918. $this->output = $output;
  32919. switch (true) {
  32920. case $object instanceof InputArgument:
  32921. $this->describeInputArgument($object, $options);
  32922. break;
  32923. case $object instanceof InputOption:
  32924. $this->describeInputOption($object, $options);
  32925. break;
  32926. case $object instanceof InputDefinition:
  32927. $this->describeInputDefinition($object, $options);
  32928. break;
  32929. case $object instanceof Command:
  32930. $this->describeCommand($object, $options);
  32931. break;
  32932. case $object instanceof Application:
  32933. $this->describeApplication($object, $options);
  32934. break;
  32935. default:
  32936. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  32937. }
  32938. }
  32939. protected function write($content, $decorated = false)
  32940. {
  32941. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  32942. }
  32943. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  32944. abstract protected function describeInputOption(InputOption $option, array $options = array());
  32945. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  32946. abstract protected function describeCommand(Command $command, array $options = array());
  32947. abstract protected function describeApplication(Application $application, array $options = array());
  32948. }
  32949. <?php
  32950. namespace Symfony\Component\Console\Descriptor;
  32951. use Symfony\Component\Console\Output\OutputInterface;
  32952. interface DescriptorInterface
  32953. {
  32954. public function describe(OutputInterface $output, $object, array $options = array());
  32955. }
  32956. <?php
  32957. namespace Symfony\Component\Console\Descriptor;
  32958. use Symfony\Component\Console\Application;
  32959. use Symfony\Component\Console\Command\Command;
  32960. use Symfony\Component\Console\Input\InputArgument;
  32961. use Symfony\Component\Console\Input\InputDefinition;
  32962. use Symfony\Component\Console\Input\InputOption;
  32963. class JsonDescriptor extends Descriptor
  32964. {
  32965. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32966. {
  32967. $this->writeData($this->getInputArgumentData($argument), $options);
  32968. }
  32969. protected function describeInputOption(InputOption $option, array $options = array())
  32970. {
  32971. $this->writeData($this->getInputOptionData($option), $options);
  32972. }
  32973. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32974. {
  32975. $this->writeData($this->getInputDefinitionData($definition), $options);
  32976. }
  32977. protected function describeCommand(Command $command, array $options = array())
  32978. {
  32979. $this->writeData($this->getCommandData($command), $options);
  32980. }
  32981. protected function describeApplication(Application $application, array $options = array())
  32982. {
  32983. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32984. $description = new ApplicationDescription($application, $describedNamespace);
  32985. $commands = array();
  32986. foreach ($description->getCommands() as $command) {
  32987. $commands[] = $this->getCommandData($command);
  32988. }
  32989. $data = $describedNamespace
  32990. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  32991. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  32992. $this->writeData($data, $options);
  32993. }
  32994. private function writeData(array $data, array $options)
  32995. {
  32996. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  32997. }
  32998. private function getInputArgumentData(InputArgument $argument)
  32999. {
  33000. return array(
  33001. 'name' => $argument->getName(),
  33002. 'is_required' => $argument->isRequired(),
  33003. 'is_array' => $argument->isArray(),
  33004. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  33005. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  33006. );
  33007. }
  33008. private function getInputOptionData(InputOption $option)
  33009. {
  33010. return array(
  33011. 'name' => '--'.$option->getName(),
  33012. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  33013. 'accept_value' => $option->acceptValue(),
  33014. 'is_value_required' => $option->isValueRequired(),
  33015. 'is_multiple' => $option->isArray(),
  33016. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  33017. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  33018. );
  33019. }
  33020. private function getInputDefinitionData(InputDefinition $definition)
  33021. {
  33022. $inputArguments = array();
  33023. foreach ($definition->getArguments() as $name => $argument) {
  33024. $inputArguments[$name] = $this->getInputArgumentData($argument);
  33025. }
  33026. $inputOptions = array();
  33027. foreach ($definition->getOptions() as $name => $option) {
  33028. $inputOptions[$name] = $this->getInputOptionData($option);
  33029. }
  33030. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  33031. }
  33032. private function getCommandData(Command $command)
  33033. {
  33034. $command->getSynopsis();
  33035. $command->mergeApplicationDefinition(false);
  33036. return array(
  33037. 'name' => $command->getName(),
  33038. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  33039. 'description' => $command->getDescription(),
  33040. 'help' => $command->getProcessedHelp(),
  33041. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  33042. );
  33043. }
  33044. }
  33045. <?php
  33046. namespace Symfony\Component\Console\Descriptor;
  33047. use Symfony\Component\Console\Application;
  33048. use Symfony\Component\Console\Command\Command;
  33049. use Symfony\Component\Console\Helper\Helper;
  33050. use Symfony\Component\Console\Input\InputArgument;
  33051. use Symfony\Component\Console\Input\InputDefinition;
  33052. use Symfony\Component\Console\Input\InputOption;
  33053. class MarkdownDescriptor extends Descriptor
  33054. {
  33055. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33056. {
  33057. $this->write(
  33058. '**'.$argument->getName().':**'."\n\n"
  33059. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  33060. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  33061. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  33062. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  33063. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  33064. );
  33065. }
  33066. protected function describeInputOption(InputOption $option, array $options = array())
  33067. {
  33068. $this->write(
  33069. '**'.$option->getName().':**'."\n\n"
  33070. .'* Name: `--'.$option->getName().'`'."\n"
  33071. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  33072. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  33073. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  33074. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  33075. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  33076. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  33077. );
  33078. }
  33079. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33080. {
  33081. if ($showArguments = \count($definition->getArguments()) > 0) {
  33082. $this->write('### Arguments:');
  33083. foreach ($definition->getArguments() as $argument) {
  33084. $this->write("\n\n");
  33085. $this->write($this->describeInputArgument($argument));
  33086. }
  33087. }
  33088. if (\count($definition->getOptions()) > 0) {
  33089. if ($showArguments) {
  33090. $this->write("\n\n");
  33091. }
  33092. $this->write('### Options:');
  33093. foreach ($definition->getOptions() as $option) {
  33094. $this->write("\n\n");
  33095. $this->write($this->describeInputOption($option));
  33096. }
  33097. }
  33098. }
  33099. protected function describeCommand(Command $command, array $options = array())
  33100. {
  33101. $command->getSynopsis();
  33102. $command->mergeApplicationDefinition(false);
  33103. $this->write(
  33104. $command->getName()."\n"
  33105. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  33106. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  33107. .'* Usage:'."\n\n"
  33108. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  33109. return $carry.' * `'.$usage.'`'."\n";
  33110. })
  33111. );
  33112. if ($help = $command->getProcessedHelp()) {
  33113. $this->write("\n");
  33114. $this->write($help);
  33115. }
  33116. if ($command->getNativeDefinition()) {
  33117. $this->write("\n\n");
  33118. $this->describeInputDefinition($command->getNativeDefinition());
  33119. }
  33120. }
  33121. protected function describeApplication(Application $application, array $options = array())
  33122. {
  33123. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33124. $description = new ApplicationDescription($application, $describedNamespace);
  33125. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  33126. foreach ($description->getNamespaces() as $namespace) {
  33127. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33128. $this->write("\n\n");
  33129. $this->write('**'.$namespace['id'].':**');
  33130. }
  33131. $this->write("\n\n");
  33132. $this->write(implode("\n", array_map(function ($commandName) {
  33133. return '* '.$commandName;
  33134. }, $namespace['commands'])));
  33135. }
  33136. foreach ($description->getCommands() as $command) {
  33137. $this->write("\n\n");
  33138. $this->write($this->describeCommand($command));
  33139. }
  33140. }
  33141. }
  33142. <?php
  33143. namespace Symfony\Component\Console\Descriptor;
  33144. use Symfony\Component\Console\Application;
  33145. use Symfony\Component\Console\Command\Command;
  33146. use Symfony\Component\Console\Formatter\OutputFormatter;
  33147. use Symfony\Component\Console\Helper\Helper;
  33148. use Symfony\Component\Console\Input\InputArgument;
  33149. use Symfony\Component\Console\Input\InputDefinition;
  33150. use Symfony\Component\Console\Input\InputOption;
  33151. class TextDescriptor extends Descriptor
  33152. {
  33153. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33154. {
  33155. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  33156. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  33157. } else {
  33158. $default = '';
  33159. }
  33160. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  33161. $spacingWidth = $totalWidth - \strlen($argument->getName());
  33162. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  33163. $argument->getName(),
  33164. str_repeat(' ', $spacingWidth),
  33165. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  33166. $default
  33167. ), $options);
  33168. }
  33169. protected function describeInputOption(InputOption $option, array $options = array())
  33170. {
  33171. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  33172. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  33173. } else {
  33174. $default = '';
  33175. }
  33176. $value = '';
  33177. if ($option->acceptValue()) {
  33178. $value = '='.strtoupper($option->getName());
  33179. if ($option->isValueOptional()) {
  33180. $value = '['.$value.']';
  33181. }
  33182. }
  33183. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  33184. $synopsis = sprintf('%s%s',
  33185. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  33186. sprintf('--%s%s', $option->getName(), $value)
  33187. );
  33188. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  33189. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  33190. $synopsis,
  33191. str_repeat(' ', $spacingWidth),
  33192. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  33193. $default,
  33194. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  33195. ), $options);
  33196. }
  33197. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33198. {
  33199. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  33200. foreach ($definition->getArguments() as $argument) {
  33201. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  33202. }
  33203. if ($definition->getArguments()) {
  33204. $this->writeText('<comment>Arguments:</comment>', $options);
  33205. $this->writeText("\n");
  33206. foreach ($definition->getArguments() as $argument) {
  33207. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  33208. $this->writeText("\n");
  33209. }
  33210. }
  33211. if ($definition->getArguments() && $definition->getOptions()) {
  33212. $this->writeText("\n");
  33213. }
  33214. if ($definition->getOptions()) {
  33215. $laterOptions = array();
  33216. $this->writeText('<comment>Options:</comment>', $options);
  33217. foreach ($definition->getOptions() as $option) {
  33218. if (\strlen($option->getShortcut()) > 1) {
  33219. $laterOptions[] = $option;
  33220. continue;
  33221. }
  33222. $this->writeText("\n");
  33223. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33224. }
  33225. foreach ($laterOptions as $option) {
  33226. $this->writeText("\n");
  33227. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33228. }
  33229. }
  33230. }
  33231. protected function describeCommand(Command $command, array $options = array())
  33232. {
  33233. $command->getSynopsis(true);
  33234. $command->getSynopsis(false);
  33235. $command->mergeApplicationDefinition(false);
  33236. $this->writeText('<comment>Usage:</comment>', $options);
  33237. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  33238. $this->writeText("\n");
  33239. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  33240. }
  33241. $this->writeText("\n");
  33242. $definition = $command->getNativeDefinition();
  33243. if ($definition->getOptions() || $definition->getArguments()) {
  33244. $this->writeText("\n");
  33245. $this->describeInputDefinition($definition, $options);
  33246. $this->writeText("\n");
  33247. }
  33248. if ($help = $command->getProcessedHelp()) {
  33249. $this->writeText("\n");
  33250. $this->writeText('<comment>Help:</comment>', $options);
  33251. $this->writeText("\n");
  33252. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  33253. $this->writeText("\n");
  33254. }
  33255. }
  33256. protected function describeApplication(Application $application, array $options = array())
  33257. {
  33258. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33259. $description = new ApplicationDescription($application, $describedNamespace);
  33260. if (isset($options['raw_text']) && $options['raw_text']) {
  33261. $width = $this->getColumnWidth($description->getCommands());
  33262. foreach ($description->getCommands() as $command) {
  33263. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  33264. $this->writeText("\n");
  33265. }
  33266. } else {
  33267. if ('' != $help = $application->getHelp()) {
  33268. $this->writeText("$help\n\n", $options);
  33269. }
  33270. $this->writeText("<comment>Usage:</comment>\n", $options);
  33271. $this->writeText(" command [options] [arguments]\n\n", $options);
  33272. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  33273. $this->writeText("\n");
  33274. $this->writeText("\n");
  33275. $width = $this->getColumnWidth($description->getCommands());
  33276. if ($describedNamespace) {
  33277. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  33278. } else {
  33279. $this->writeText('<comment>Available commands:</comment>', $options);
  33280. }
  33281. foreach ($description->getNamespaces() as $namespace) {
  33282. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33283. $this->writeText("\n");
  33284. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  33285. }
  33286. foreach ($namespace['commands'] as $name) {
  33287. $this->writeText("\n");
  33288. $spacingWidth = $width - Helper::strlen($name);
  33289. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  33290. }
  33291. }
  33292. $this->writeText("\n");
  33293. }
  33294. }
  33295. private function writeText($content, array $options = array())
  33296. {
  33297. $this->write(
  33298. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  33299. isset($options['raw_output']) ? !$options['raw_output'] : true
  33300. );
  33301. }
  33302. private function formatDefaultValue($default)
  33303. {
  33304. if (INF === $default) {
  33305. return 'INF';
  33306. }
  33307. if (\is_string($default)) {
  33308. $default = OutputFormatter::escape($default);
  33309. } elseif (\is_array($default)) {
  33310. foreach ($default as $key => $value) {
  33311. if (\is_string($value)) {
  33312. $default[$key] = OutputFormatter::escape($value);
  33313. }
  33314. }
  33315. }
  33316. if (\PHP_VERSION_ID < 50400) {
  33317. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  33318. }
  33319. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  33320. }
  33321. private function getColumnWidth(array $commands)
  33322. {
  33323. $widths = array();
  33324. foreach ($commands as $command) {
  33325. $widths[] = Helper::strlen($command->getName());
  33326. foreach ($command->getAliases() as $alias) {
  33327. $widths[] = Helper::strlen($alias);
  33328. }
  33329. }
  33330. return max($widths) + 2;
  33331. }
  33332. private function calculateTotalWidthForOptions(array $options)
  33333. {
  33334. $totalWidth = 0;
  33335. foreach ($options as $option) {
  33336. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  33337. if ($option->acceptValue()) {
  33338. $valueLength = 1 + Helper::strlen($option->getName());
  33339. $valueLength += $option->isValueOptional() ? 2 : 0;
  33340. $nameLength += $valueLength;
  33341. }
  33342. $totalWidth = max($totalWidth, $nameLength);
  33343. }
  33344. return $totalWidth;
  33345. }
  33346. }
  33347. <?php
  33348. namespace Symfony\Component\Console\Descriptor;
  33349. use Symfony\Component\Console\Application;
  33350. use Symfony\Component\Console\Command\Command;
  33351. use Symfony\Component\Console\Input\InputArgument;
  33352. use Symfony\Component\Console\Input\InputDefinition;
  33353. use Symfony\Component\Console\Input\InputOption;
  33354. class XmlDescriptor extends Descriptor
  33355. {
  33356. public function getInputDefinitionDocument(InputDefinition $definition)
  33357. {
  33358. $dom = new \DOMDocument('1.0', 'UTF-8');
  33359. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  33360. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  33361. foreach ($definition->getArguments() as $argument) {
  33362. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  33363. }
  33364. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  33365. foreach ($definition->getOptions() as $option) {
  33366. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  33367. }
  33368. return $dom;
  33369. }
  33370. public function getCommandDocument(Command $command)
  33371. {
  33372. $dom = new \DOMDocument('1.0', 'UTF-8');
  33373. $dom->appendChild($commandXML = $dom->createElement('command'));
  33374. $command->getSynopsis();
  33375. $command->mergeApplicationDefinition(false);
  33376. $commandXML->setAttribute('id', $command->getName());
  33377. $commandXML->setAttribute('name', $command->getName());
  33378. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  33379. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  33380. $usagesXML->appendChild($dom->createElement('usage', $usage));
  33381. }
  33382. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  33383. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  33384. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  33385. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  33386. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  33387. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  33388. return $dom;
  33389. }
  33390. public function getApplicationDocument(Application $application, $namespace = null)
  33391. {
  33392. $dom = new \DOMDocument('1.0', 'UTF-8');
  33393. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  33394. if ('UNKNOWN' !== $application->getName()) {
  33395. $rootXml->setAttribute('name', $application->getName());
  33396. if ('UNKNOWN' !== $application->getVersion()) {
  33397. $rootXml->setAttribute('version', $application->getVersion());
  33398. }
  33399. }
  33400. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  33401. $description = new ApplicationDescription($application, $namespace);
  33402. if ($namespace) {
  33403. $commandsXML->setAttribute('namespace', $namespace);
  33404. }
  33405. foreach ($description->getCommands() as $command) {
  33406. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  33407. }
  33408. if (!$namespace) {
  33409. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  33410. foreach ($description->getNamespaces() as $namespaceDescription) {
  33411. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  33412. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  33413. foreach ($namespaceDescription['commands'] as $name) {
  33414. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  33415. $commandXML->appendChild($dom->createTextNode($name));
  33416. }
  33417. }
  33418. }
  33419. return $dom;
  33420. }
  33421. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33422. {
  33423. $this->writeDocument($this->getInputArgumentDocument($argument));
  33424. }
  33425. protected function describeInputOption(InputOption $option, array $options = array())
  33426. {
  33427. $this->writeDocument($this->getInputOptionDocument($option));
  33428. }
  33429. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33430. {
  33431. $this->writeDocument($this->getInputDefinitionDocument($definition));
  33432. }
  33433. protected function describeCommand(Command $command, array $options = array())
  33434. {
  33435. $this->writeDocument($this->getCommandDocument($command));
  33436. }
  33437. protected function describeApplication(Application $application, array $options = array())
  33438. {
  33439. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  33440. }
  33441. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  33442. {
  33443. foreach ($importedParent->childNodes as $childNode) {
  33444. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  33445. }
  33446. }
  33447. private function writeDocument(\DOMDocument $dom)
  33448. {
  33449. $dom->formatOutput = true;
  33450. $this->write($dom->saveXML());
  33451. }
  33452. private function getInputArgumentDocument(InputArgument $argument)
  33453. {
  33454. $dom = new \DOMDocument('1.0', 'UTF-8');
  33455. $dom->appendChild($objectXML = $dom->createElement('argument'));
  33456. $objectXML->setAttribute('name', $argument->getName());
  33457. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  33458. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  33459. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33460. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  33461. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33462. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  33463. foreach ($defaults as $default) {
  33464. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33465. $defaultXML->appendChild($dom->createTextNode($default));
  33466. }
  33467. return $dom;
  33468. }
  33469. private function getInputOptionDocument(InputOption $option)
  33470. {
  33471. $dom = new \DOMDocument('1.0', 'UTF-8');
  33472. $dom->appendChild($objectXML = $dom->createElement('option'));
  33473. $objectXML->setAttribute('name', '--'.$option->getName());
  33474. $pos = strpos($option->getShortcut(), '|');
  33475. if (false !== $pos) {
  33476. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  33477. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  33478. } else {
  33479. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  33480. }
  33481. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  33482. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  33483. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  33484. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33485. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  33486. if ($option->acceptValue()) {
  33487. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  33488. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33489. if (!empty($defaults)) {
  33490. foreach ($defaults as $default) {
  33491. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33492. $defaultXML->appendChild($dom->createTextNode($default));
  33493. }
  33494. }
  33495. }
  33496. return $dom;
  33497. }
  33498. }
  33499. <?php
  33500. namespace Symfony\Component\Console\Event;
  33501. class ConsoleCommandEvent extends ConsoleEvent
  33502. {
  33503. const RETURN_CODE_DISABLED = 113;
  33504. private $commandShouldRun = true;
  33505. public function disableCommand()
  33506. {
  33507. return $this->commandShouldRun = false;
  33508. }
  33509. public function enableCommand()
  33510. {
  33511. return $this->commandShouldRun = true;
  33512. }
  33513. public function commandShouldRun()
  33514. {
  33515. return $this->commandShouldRun;
  33516. }
  33517. }
  33518. <?php
  33519. namespace Symfony\Component\Console\Event;
  33520. use Symfony\Component\Console\Command\Command;
  33521. use Symfony\Component\Console\Input\InputInterface;
  33522. use Symfony\Component\Console\Output\OutputInterface;
  33523. use Symfony\Component\EventDispatcher\Event;
  33524. class ConsoleEvent extends Event
  33525. {
  33526. protected $command;
  33527. private $input;
  33528. private $output;
  33529. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  33530. {
  33531. $this->command = $command;
  33532. $this->input = $input;
  33533. $this->output = $output;
  33534. }
  33535. public function getCommand()
  33536. {
  33537. return $this->command;
  33538. }
  33539. public function getInput()
  33540. {
  33541. return $this->input;
  33542. }
  33543. public function getOutput()
  33544. {
  33545. return $this->output;
  33546. }
  33547. }
  33548. <?php
  33549. namespace Symfony\Component\Console\Event;
  33550. use Symfony\Component\Console\Command\Command;
  33551. use Symfony\Component\Console\Input\InputInterface;
  33552. use Symfony\Component\Console\Output\OutputInterface;
  33553. class ConsoleExceptionEvent extends ConsoleEvent
  33554. {
  33555. private $exception;
  33556. private $exitCode;
  33557. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  33558. {
  33559. parent::__construct($command, $input, $output);
  33560. $this->setException($exception);
  33561. $this->exitCode = (int) $exitCode;
  33562. }
  33563. public function getException()
  33564. {
  33565. return $this->exception;
  33566. }
  33567. public function setException(\Exception $exception)
  33568. {
  33569. $this->exception = $exception;
  33570. }
  33571. public function getExitCode()
  33572. {
  33573. return $this->exitCode;
  33574. }
  33575. }
  33576. <?php
  33577. namespace Symfony\Component\Console\Event;
  33578. use Symfony\Component\Console\Command\Command;
  33579. use Symfony\Component\Console\Input\InputInterface;
  33580. use Symfony\Component\Console\Output\OutputInterface;
  33581. class ConsoleTerminateEvent extends ConsoleEvent
  33582. {
  33583. private $exitCode;
  33584. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  33585. {
  33586. parent::__construct($command, $input, $output);
  33587. $this->setExitCode($exitCode);
  33588. }
  33589. public function setExitCode($exitCode)
  33590. {
  33591. $this->exitCode = (int) $exitCode;
  33592. }
  33593. public function getExitCode()
  33594. {
  33595. return $this->exitCode;
  33596. }
  33597. }
  33598. <?php
  33599. namespace Symfony\Component\Console\Exception;
  33600. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  33601. {
  33602. private $alternatives;
  33603. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  33604. {
  33605. parent::__construct($message, $code, $previous);
  33606. $this->alternatives = $alternatives;
  33607. }
  33608. public function getAlternatives()
  33609. {
  33610. return $this->alternatives;
  33611. }
  33612. }
  33613. <?php
  33614. namespace Symfony\Component\Console\Exception;
  33615. interface ExceptionInterface
  33616. {
  33617. }
  33618. <?php
  33619. namespace Symfony\Component\Console\Exception;
  33620. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  33621. {
  33622. }
  33623. <?php
  33624. namespace Symfony\Component\Console\Exception;
  33625. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  33626. {
  33627. }
  33628. <?php
  33629. namespace Symfony\Component\Console\Exception;
  33630. class LogicException extends \LogicException implements ExceptionInterface
  33631. {
  33632. }
  33633. <?php
  33634. namespace Symfony\Component\Console\Exception;
  33635. class RuntimeException extends \RuntimeException implements ExceptionInterface
  33636. {
  33637. }
  33638. <?php
  33639. namespace Symfony\Component\Console\Formatter;
  33640. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33641. class OutputFormatter implements OutputFormatterInterface
  33642. {
  33643. private $decorated;
  33644. private $styles = array();
  33645. private $styleStack;
  33646. public static function escape($text)
  33647. {
  33648. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  33649. return self::escapeTrailingBackslash($text);
  33650. }
  33651. public static function escapeTrailingBackslash($text)
  33652. {
  33653. if ('\\' === substr($text, -1)) {
  33654. $len = \strlen($text);
  33655. $text = rtrim($text, '\\');
  33656. $text = str_replace("\0", '', $text);
  33657. $text .= str_repeat("\0", $len - \strlen($text));
  33658. }
  33659. return $text;
  33660. }
  33661. public function __construct($decorated = false, array $styles = array())
  33662. {
  33663. $this->decorated = (bool) $decorated;
  33664. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  33665. $this->setStyle('info', new OutputFormatterStyle('green'));
  33666. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  33667. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  33668. foreach ($styles as $name => $style) {
  33669. $this->setStyle($name, $style);
  33670. }
  33671. $this->styleStack = new OutputFormatterStyleStack();
  33672. }
  33673. public function setDecorated($decorated)
  33674. {
  33675. $this->decorated = (bool) $decorated;
  33676. }
  33677. public function isDecorated()
  33678. {
  33679. return $this->decorated;
  33680. }
  33681. public function setStyle($name, OutputFormatterStyleInterface $style)
  33682. {
  33683. $this->styles[strtolower($name)] = $style;
  33684. }
  33685. public function hasStyle($name)
  33686. {
  33687. return isset($this->styles[strtolower($name)]);
  33688. }
  33689. public function getStyle($name)
  33690. {
  33691. if (!$this->hasStyle($name)) {
  33692. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  33693. }
  33694. return $this->styles[strtolower($name)];
  33695. }
  33696. public function format($message)
  33697. {
  33698. $message = (string) $message;
  33699. $offset = 0;
  33700. $output = '';
  33701. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  33702. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  33703. foreach ($matches[0] as $i => $match) {
  33704. $pos = $match[1];
  33705. $text = $match[0];
  33706. if (0 != $pos && '\\' == $message[$pos - 1]) {
  33707. continue;
  33708. }
  33709. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  33710. $offset = $pos + \strlen($text);
  33711. if ($open = '/' != $text[1]) {
  33712. $tag = $matches[1][$i][0];
  33713. } else {
  33714. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  33715. }
  33716. if (!$open && !$tag) {
  33717. $this->styleStack->pop();
  33718. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  33719. $output .= $this->applyCurrentStyle($text);
  33720. } elseif ($open) {
  33721. $this->styleStack->push($style);
  33722. } else {
  33723. $this->styleStack->pop($style);
  33724. }
  33725. }
  33726. $output .= $this->applyCurrentStyle(substr($message, $offset));
  33727. if (false !== strpos($output, "\0")) {
  33728. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  33729. }
  33730. return str_replace('\\<', '<', $output);
  33731. }
  33732. public function getStyleStack()
  33733. {
  33734. return $this->styleStack;
  33735. }
  33736. private function createStyleFromString($string)
  33737. {
  33738. if (isset($this->styles[$string])) {
  33739. return $this->styles[$string];
  33740. }
  33741. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  33742. return false;
  33743. }
  33744. $style = new OutputFormatterStyle();
  33745. foreach ($matches as $match) {
  33746. array_shift($match);
  33747. if ('fg' == $match[0]) {
  33748. $style->setForeground($match[1]);
  33749. } elseif ('bg' == $match[0]) {
  33750. $style->setBackground($match[1]);
  33751. } else {
  33752. try {
  33753. $style->setOption($match[1]);
  33754. } catch (\InvalidArgumentException $e) {
  33755. return false;
  33756. }
  33757. }
  33758. }
  33759. return $style;
  33760. }
  33761. private function applyCurrentStyle($text)
  33762. {
  33763. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  33764. }
  33765. }
  33766. <?php
  33767. namespace Symfony\Component\Console\Formatter;
  33768. interface OutputFormatterInterface
  33769. {
  33770. public function setDecorated($decorated);
  33771. public function isDecorated();
  33772. public function setStyle($name, OutputFormatterStyleInterface $style);
  33773. public function hasStyle($name);
  33774. public function getStyle($name);
  33775. public function format($message);
  33776. }
  33777. <?php
  33778. namespace Symfony\Component\Console\Formatter;
  33779. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33780. class OutputFormatterStyle implements OutputFormatterStyleInterface
  33781. {
  33782. private static $availableForegroundColors = array(
  33783. 'black' => array('set' => 30, 'unset' => 39),
  33784. 'red' => array('set' => 31, 'unset' => 39),
  33785. 'green' => array('set' => 32, 'unset' => 39),
  33786. 'yellow' => array('set' => 33, 'unset' => 39),
  33787. 'blue' => array('set' => 34, 'unset' => 39),
  33788. 'magenta' => array('set' => 35, 'unset' => 39),
  33789. 'cyan' => array('set' => 36, 'unset' => 39),
  33790. 'white' => array('set' => 37, 'unset' => 39),
  33791. 'default' => array('set' => 39, 'unset' => 39),
  33792. );
  33793. private static $availableBackgroundColors = array(
  33794. 'black' => array('set' => 40, 'unset' => 49),
  33795. 'red' => array('set' => 41, 'unset' => 49),
  33796. 'green' => array('set' => 42, 'unset' => 49),
  33797. 'yellow' => array('set' => 43, 'unset' => 49),
  33798. 'blue' => array('set' => 44, 'unset' => 49),
  33799. 'magenta' => array('set' => 45, 'unset' => 49),
  33800. 'cyan' => array('set' => 46, 'unset' => 49),
  33801. 'white' => array('set' => 47, 'unset' => 49),
  33802. 'default' => array('set' => 49, 'unset' => 49),
  33803. );
  33804. private static $availableOptions = array(
  33805. 'bold' => array('set' => 1, 'unset' => 22),
  33806. 'underscore' => array('set' => 4, 'unset' => 24),
  33807. 'blink' => array('set' => 5, 'unset' => 25),
  33808. 'reverse' => array('set' => 7, 'unset' => 27),
  33809. 'conceal' => array('set' => 8, 'unset' => 28),
  33810. );
  33811. private $foreground;
  33812. private $background;
  33813. private $options = array();
  33814. public function __construct($foreground = null, $background = null, array $options = array())
  33815. {
  33816. if (null !== $foreground) {
  33817. $this->setForeground($foreground);
  33818. }
  33819. if (null !== $background) {
  33820. $this->setBackground($background);
  33821. }
  33822. if (\count($options)) {
  33823. $this->setOptions($options);
  33824. }
  33825. }
  33826. public function setForeground($color = null)
  33827. {
  33828. if (null === $color) {
  33829. $this->foreground = null;
  33830. return;
  33831. }
  33832. if (!isset(static::$availableForegroundColors[$color])) {
  33833. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  33834. }
  33835. $this->foreground = static::$availableForegroundColors[$color];
  33836. }
  33837. public function setBackground($color = null)
  33838. {
  33839. if (null === $color) {
  33840. $this->background = null;
  33841. return;
  33842. }
  33843. if (!isset(static::$availableBackgroundColors[$color])) {
  33844. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  33845. }
  33846. $this->background = static::$availableBackgroundColors[$color];
  33847. }
  33848. public function setOption($option)
  33849. {
  33850. if (!isset(static::$availableOptions[$option])) {
  33851. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33852. }
  33853. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  33854. $this->options[] = static::$availableOptions[$option];
  33855. }
  33856. }
  33857. public function unsetOption($option)
  33858. {
  33859. if (!isset(static::$availableOptions[$option])) {
  33860. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33861. }
  33862. $pos = array_search(static::$availableOptions[$option], $this->options);
  33863. if (false !== $pos) {
  33864. unset($this->options[$pos]);
  33865. }
  33866. }
  33867. public function setOptions(array $options)
  33868. {
  33869. $this->options = array();
  33870. foreach ($options as $option) {
  33871. $this->setOption($option);
  33872. }
  33873. }
  33874. public function apply($text)
  33875. {
  33876. $setCodes = array();
  33877. $unsetCodes = array();
  33878. if (null !== $this->foreground) {
  33879. $setCodes[] = $this->foreground['set'];
  33880. $unsetCodes[] = $this->foreground['unset'];
  33881. }
  33882. if (null !== $this->background) {
  33883. $setCodes[] = $this->background['set'];
  33884. $unsetCodes[] = $this->background['unset'];
  33885. }
  33886. if (\count($this->options)) {
  33887. foreach ($this->options as $option) {
  33888. $setCodes[] = $option['set'];
  33889. $unsetCodes[] = $option['unset'];
  33890. }
  33891. }
  33892. if (0 === \count($setCodes)) {
  33893. return $text;
  33894. }
  33895. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33896. }
  33897. }
  33898. <?php
  33899. namespace Symfony\Component\Console\Formatter;
  33900. interface OutputFormatterStyleInterface
  33901. {
  33902. public function setForeground($color = null);
  33903. public function setBackground($color = null);
  33904. public function setOption($option);
  33905. public function unsetOption($option);
  33906. public function setOptions(array $options);
  33907. public function apply($text);
  33908. }
  33909. <?php
  33910. namespace Symfony\Component\Console\Formatter;
  33911. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33912. class OutputFormatterStyleStack
  33913. {
  33914. private $styles;
  33915. private $emptyStyle;
  33916. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  33917. {
  33918. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  33919. $this->reset();
  33920. }
  33921. public function reset()
  33922. {
  33923. $this->styles = array();
  33924. }
  33925. public function push(OutputFormatterStyleInterface $style)
  33926. {
  33927. $this->styles[] = $style;
  33928. }
  33929. public function pop(OutputFormatterStyleInterface $style = null)
  33930. {
  33931. if (empty($this->styles)) {
  33932. return $this->emptyStyle;
  33933. }
  33934. if (null === $style) {
  33935. return array_pop($this->styles);
  33936. }
  33937. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  33938. if ($style->apply('') === $stackedStyle->apply('')) {
  33939. $this->styles = \array_slice($this->styles, 0, $index);
  33940. return $stackedStyle;
  33941. }
  33942. }
  33943. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  33944. }
  33945. public function getCurrent()
  33946. {
  33947. if (empty($this->styles)) {
  33948. return $this->emptyStyle;
  33949. }
  33950. return $this->styles[\count($this->styles) - 1];
  33951. }
  33952. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  33953. {
  33954. $this->emptyStyle = $emptyStyle;
  33955. return $this;
  33956. }
  33957. public function getEmptyStyle()
  33958. {
  33959. return $this->emptyStyle;
  33960. }
  33961. }
  33962. <?php
  33963. namespace Symfony\Component\Console\Helper;
  33964. class DebugFormatterHelper extends Helper
  33965. {
  33966. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  33967. private $started = array();
  33968. private $count = -1;
  33969. public function start($id, $message, $prefix = 'RUN')
  33970. {
  33971. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  33972. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  33973. }
  33974. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  33975. {
  33976. $message = '';
  33977. if ($error) {
  33978. if (isset($this->started[$id]['out'])) {
  33979. $message .= "\n";
  33980. unset($this->started[$id]['out']);
  33981. }
  33982. if (!isset($this->started[$id]['err'])) {
  33983. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  33984. $this->started[$id]['err'] = true;
  33985. }
  33986. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  33987. } else {
  33988. if (isset($this->started[$id]['err'])) {
  33989. $message .= "\n";
  33990. unset($this->started[$id]['err']);
  33991. }
  33992. if (!isset($this->started[$id]['out'])) {
  33993. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  33994. $this->started[$id]['out'] = true;
  33995. }
  33996. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  33997. }
  33998. return $message;
  33999. }
  34000. public function stop($id, $message, $successful, $prefix = 'RES')
  34001. {
  34002. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  34003. if ($successful) {
  34004. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34005. }
  34006. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34007. unset($this->started[$id]['out'], $this->started[$id]['err']);
  34008. return $message;
  34009. }
  34010. private function getBorder($id)
  34011. {
  34012. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  34013. }
  34014. public function getName()
  34015. {
  34016. return 'debug_formatter';
  34017. }
  34018. }
  34019. <?php
  34020. namespace Symfony\Component\Console\Helper;
  34021. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  34022. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  34023. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  34024. use Symfony\Component\Console\Descriptor\TextDescriptor;
  34025. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  34026. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34027. use Symfony\Component\Console\Output\OutputInterface;
  34028. class DescriptorHelper extends Helper
  34029. {
  34030. private $descriptors = array();
  34031. public function __construct()
  34032. {
  34033. $this
  34034. ->register('txt', new TextDescriptor())
  34035. ->register('xml', new XmlDescriptor())
  34036. ->register('json', new JsonDescriptor())
  34037. ->register('md', new MarkdownDescriptor())
  34038. ;
  34039. }
  34040. public function describe(OutputInterface $output, $object, array $options = array())
  34041. {
  34042. $options = array_merge(array(
  34043. 'raw_text' => false,
  34044. 'format' => 'txt',
  34045. ), $options);
  34046. if (!isset($this->descriptors[$options['format']])) {
  34047. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  34048. }
  34049. $descriptor = $this->descriptors[$options['format']];
  34050. $descriptor->describe($output, $object, $options);
  34051. }
  34052. public function register($format, DescriptorInterface $descriptor)
  34053. {
  34054. $this->descriptors[$format] = $descriptor;
  34055. return $this;
  34056. }
  34057. public function getName()
  34058. {
  34059. return 'descriptor';
  34060. }
  34061. }
  34062. <?php
  34063. namespace Symfony\Component\Console\Helper;
  34064. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34065. use Symfony\Component\Console\Exception\RuntimeException;
  34066. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34067. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34068. use Symfony\Component\Console\Output\OutputInterface;
  34069. class DialogHelper extends InputAwareHelper
  34070. {
  34071. private $inputStream;
  34072. private static $shell;
  34073. private static $stty;
  34074. public function __construct($triggerDeprecationError = true)
  34075. {
  34076. if ($triggerDeprecationError) {
  34077. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  34078. }
  34079. }
  34080. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  34081. {
  34082. if ($output instanceof ConsoleOutputInterface) {
  34083. $output = $output->getErrorOutput();
  34084. }
  34085. $width = max(array_map('strlen', array_keys($choices)));
  34086. $messages = (array) $question;
  34087. foreach ($choices as $key => $value) {
  34088. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  34089. }
  34090. $output->writeln($messages);
  34091. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  34092. $selectedChoices = str_replace(' ', '', $picked);
  34093. if ($multiselect) {
  34094. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  34095. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  34096. }
  34097. $selectedChoices = explode(',', $selectedChoices);
  34098. } else {
  34099. $selectedChoices = array($picked);
  34100. }
  34101. $multiselectChoices = array();
  34102. foreach ($selectedChoices as $value) {
  34103. if (empty($choices[$value])) {
  34104. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  34105. }
  34106. $multiselectChoices[] = $value;
  34107. }
  34108. if ($multiselect) {
  34109. return $multiselectChoices;
  34110. }
  34111. return $picked;
  34112. }, $attempts, $default);
  34113. return $result;
  34114. }
  34115. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  34116. {
  34117. if ($this->input && !$this->input->isInteractive()) {
  34118. return $default;
  34119. }
  34120. if ($output instanceof ConsoleOutputInterface) {
  34121. $output = $output->getErrorOutput();
  34122. }
  34123. $output->write($question);
  34124. $inputStream = $this->inputStream ?: STDIN;
  34125. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34126. $ret = fgets($inputStream, 4096);
  34127. if (false === $ret) {
  34128. throw new RuntimeException('Aborted');
  34129. }
  34130. $ret = trim($ret);
  34131. } else {
  34132. $ret = '';
  34133. $i = 0;
  34134. $ofs = -1;
  34135. $matches = $autocomplete;
  34136. $numMatches = \count($matches);
  34137. $sttyMode = shell_exec('stty -g');
  34138. shell_exec('stty -icanon -echo');
  34139. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34140. while (!feof($inputStream)) {
  34141. $c = fread($inputStream, 1);
  34142. if ("\177" === $c) {
  34143. if (0 === $numMatches && 0 !== $i) {
  34144. --$i;
  34145. $output->write("\033[1D");
  34146. }
  34147. if (0 === $i) {
  34148. $ofs = -1;
  34149. $matches = $autocomplete;
  34150. $numMatches = \count($matches);
  34151. } else {
  34152. $numMatches = 0;
  34153. }
  34154. $ret = substr($ret, 0, $i);
  34155. } elseif ("\033" === $c) {
  34156. $c .= fread($inputStream, 2);
  34157. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34158. if ('A' === $c[2] && -1 === $ofs) {
  34159. $ofs = 0;
  34160. }
  34161. if (0 === $numMatches) {
  34162. continue;
  34163. }
  34164. $ofs += ('A' === $c[2]) ? -1 : 1;
  34165. $ofs = ($numMatches + $ofs) % $numMatches;
  34166. }
  34167. } elseif (\ord($c) < 32) {
  34168. if ("\t" === $c || "\n" === $c) {
  34169. if ($numMatches > 0 && -1 !== $ofs) {
  34170. $ret = $matches[$ofs];
  34171. $output->write(substr($ret, $i));
  34172. $i = \strlen($ret);
  34173. }
  34174. if ("\n" === $c) {
  34175. $output->write($c);
  34176. break;
  34177. }
  34178. $numMatches = 0;
  34179. }
  34180. continue;
  34181. } else {
  34182. $output->write($c);
  34183. $ret .= $c;
  34184. ++$i;
  34185. $numMatches = 0;
  34186. $ofs = 0;
  34187. foreach ($autocomplete as $value) {
  34188. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  34189. $matches[$numMatches++] = $value;
  34190. }
  34191. }
  34192. }
  34193. $output->write("\033[K");
  34194. if ($numMatches > 0 && -1 !== $ofs) {
  34195. $output->write("\0337");
  34196. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  34197. $output->write("\0338");
  34198. }
  34199. }
  34200. shell_exec(sprintf('stty %s', $sttyMode));
  34201. }
  34202. return \strlen($ret) > 0 ? $ret : $default;
  34203. }
  34204. public function askConfirmation(OutputInterface $output, $question, $default = true)
  34205. {
  34206. $answer = 'z';
  34207. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  34208. $answer = $this->ask($output, $question);
  34209. }
  34210. if (false === $default) {
  34211. return $answer && 'y' == strtolower($answer[0]);
  34212. }
  34213. return !$answer || 'y' == strtolower($answer[0]);
  34214. }
  34215. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  34216. {
  34217. if ($output instanceof ConsoleOutputInterface) {
  34218. $output = $output->getErrorOutput();
  34219. }
  34220. if ('\\' === \DIRECTORY_SEPARATOR) {
  34221. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34222. if ('phar:' === substr(__FILE__, 0, 5)) {
  34223. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34224. copy($exe, $tmpExe);
  34225. $exe = $tmpExe;
  34226. }
  34227. $output->write($question);
  34228. $value = rtrim(shell_exec($exe));
  34229. $output->writeln('');
  34230. if (isset($tmpExe)) {
  34231. unlink($tmpExe);
  34232. }
  34233. return $value;
  34234. }
  34235. if ($this->hasSttyAvailable()) {
  34236. $output->write($question);
  34237. $sttyMode = shell_exec('stty -g');
  34238. shell_exec('stty -echo');
  34239. $value = fgets($this->inputStream ?: STDIN, 4096);
  34240. shell_exec(sprintf('stty %s', $sttyMode));
  34241. if (false === $value) {
  34242. throw new RuntimeException('Aborted');
  34243. }
  34244. $value = trim($value);
  34245. $output->writeln('');
  34246. return $value;
  34247. }
  34248. if (false !== $shell = $this->getShell()) {
  34249. $output->write($question);
  34250. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34251. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34252. $value = rtrim(shell_exec($command));
  34253. $output->writeln('');
  34254. return $value;
  34255. }
  34256. if ($fallback) {
  34257. return $this->ask($output, $question);
  34258. }
  34259. throw new RuntimeException('Unable to hide the response');
  34260. }
  34261. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  34262. {
  34263. $that = $this;
  34264. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  34265. return $that->ask($output, $question, $default, $autocomplete);
  34266. };
  34267. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34268. }
  34269. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  34270. {
  34271. $that = $this;
  34272. $interviewer = function () use ($output, $question, $fallback, $that) {
  34273. return $that->askHiddenResponse($output, $question, $fallback);
  34274. };
  34275. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34276. }
  34277. public function setInputStream($stream)
  34278. {
  34279. $this->inputStream = $stream;
  34280. }
  34281. public function getInputStream()
  34282. {
  34283. return $this->inputStream;
  34284. }
  34285. public function getName()
  34286. {
  34287. return 'dialog';
  34288. }
  34289. private function getShell()
  34290. {
  34291. if (null !== self::$shell) {
  34292. return self::$shell;
  34293. }
  34294. self::$shell = false;
  34295. if (file_exists('/usr/bin/env')) {
  34296. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34297. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34298. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34299. self::$shell = $sh;
  34300. break;
  34301. }
  34302. }
  34303. }
  34304. return self::$shell;
  34305. }
  34306. private function hasSttyAvailable()
  34307. {
  34308. if (null !== self::$stty) {
  34309. return self::$stty;
  34310. }
  34311. exec('stty 2>&1', $output, $exitcode);
  34312. return self::$stty = 0 === $exitcode;
  34313. }
  34314. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  34315. {
  34316. if ($output instanceof ConsoleOutputInterface) {
  34317. $output = $output->getErrorOutput();
  34318. }
  34319. $e = null;
  34320. while (false === $attempts || $attempts--) {
  34321. if (null !== $e) {
  34322. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  34323. }
  34324. try {
  34325. return \call_user_func($validator, $interviewer());
  34326. } catch (\Exception $e) {
  34327. }
  34328. }
  34329. throw $e;
  34330. }
  34331. }
  34332. <?php
  34333. namespace Symfony\Component\Console\Helper;
  34334. use Symfony\Component\Console\Formatter\OutputFormatter;
  34335. class FormatterHelper extends Helper
  34336. {
  34337. public function formatSection($section, $message, $style = 'info')
  34338. {
  34339. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  34340. }
  34341. public function formatBlock($messages, $style, $large = false)
  34342. {
  34343. if (!\is_array($messages)) {
  34344. $messages = array($messages);
  34345. }
  34346. $len = 0;
  34347. $lines = array();
  34348. foreach ($messages as $message) {
  34349. $message = OutputFormatter::escape($message);
  34350. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  34351. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  34352. }
  34353. $messages = $large ? array(str_repeat(' ', $len)) : array();
  34354. for ($i = 0; isset($lines[$i]); ++$i) {
  34355. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  34356. }
  34357. if ($large) {
  34358. $messages[] = str_repeat(' ', $len);
  34359. }
  34360. for ($i = 0; isset($messages[$i]); ++$i) {
  34361. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  34362. }
  34363. return implode("\n", $messages);
  34364. }
  34365. public function getName()
  34366. {
  34367. return 'formatter';
  34368. }
  34369. }
  34370. <?php
  34371. namespace Symfony\Component\Console\Helper;
  34372. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34373. abstract class Helper implements HelperInterface
  34374. {
  34375. protected $helperSet = null;
  34376. public function setHelperSet(HelperSet $helperSet = null)
  34377. {
  34378. $this->helperSet = $helperSet;
  34379. }
  34380. public function getHelperSet()
  34381. {
  34382. return $this->helperSet;
  34383. }
  34384. public static function strlen($string)
  34385. {
  34386. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  34387. return \strlen($string);
  34388. }
  34389. return mb_strwidth($string, $encoding);
  34390. }
  34391. public static function formatTime($secs)
  34392. {
  34393. static $timeFormats = array(
  34394. array(0, '< 1 sec'),
  34395. array(1, '1 sec'),
  34396. array(2, 'secs', 1),
  34397. array(60, '1 min'),
  34398. array(120, 'mins', 60),
  34399. array(3600, '1 hr'),
  34400. array(7200, 'hrs', 3600),
  34401. array(86400, '1 day'),
  34402. array(172800, 'days', 86400),
  34403. );
  34404. foreach ($timeFormats as $index => $format) {
  34405. if ($secs >= $format[0]) {
  34406. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  34407. || $index == \count($timeFormats) - 1
  34408. ) {
  34409. if (2 == \count($format)) {
  34410. return $format[1];
  34411. }
  34412. return floor($secs / $format[2]).' '.$format[1];
  34413. }
  34414. }
  34415. }
  34416. }
  34417. public static function formatMemory($memory)
  34418. {
  34419. if ($memory >= 1024 * 1024 * 1024) {
  34420. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  34421. }
  34422. if ($memory >= 1024 * 1024) {
  34423. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  34424. }
  34425. if ($memory >= 1024) {
  34426. return sprintf('%d KiB', $memory / 1024);
  34427. }
  34428. return sprintf('%d B', $memory);
  34429. }
  34430. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  34431. {
  34432. return self::strlen(self::removeDecoration($formatter, $string));
  34433. }
  34434. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  34435. {
  34436. $isDecorated = $formatter->isDecorated();
  34437. $formatter->setDecorated(false);
  34438. $string = $formatter->format($string);
  34439. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  34440. $formatter->setDecorated($isDecorated);
  34441. return $string;
  34442. }
  34443. }
  34444. <?php
  34445. namespace Symfony\Component\Console\Helper;
  34446. interface HelperInterface
  34447. {
  34448. public function setHelperSet(HelperSet $helperSet = null);
  34449. public function getHelperSet();
  34450. public function getName();
  34451. }
  34452. <?php
  34453. namespace Symfony\Component\Console\Helper;
  34454. use Symfony\Component\Console\Command\Command;
  34455. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34456. class HelperSet implements \IteratorAggregate
  34457. {
  34458. private $helpers = array();
  34459. private $command;
  34460. public function __construct(array $helpers = array())
  34461. {
  34462. foreach ($helpers as $alias => $helper) {
  34463. $this->set($helper, \is_int($alias) ? null : $alias);
  34464. }
  34465. }
  34466. public function set(HelperInterface $helper, $alias = null)
  34467. {
  34468. $this->helpers[$helper->getName()] = $helper;
  34469. if (null !== $alias) {
  34470. $this->helpers[$alias] = $helper;
  34471. }
  34472. $helper->setHelperSet($this);
  34473. }
  34474. public function has($name)
  34475. {
  34476. return isset($this->helpers[$name]);
  34477. }
  34478. public function get($name)
  34479. {
  34480. if (!$this->has($name)) {
  34481. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  34482. }
  34483. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  34484. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  34485. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  34486. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  34487. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  34488. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  34489. }
  34490. return $this->helpers[$name];
  34491. }
  34492. public function setCommand(Command $command = null)
  34493. {
  34494. $this->command = $command;
  34495. }
  34496. public function getCommand()
  34497. {
  34498. return $this->command;
  34499. }
  34500. public function getIterator()
  34501. {
  34502. return new \ArrayIterator($this->helpers);
  34503. }
  34504. }
  34505. <?php
  34506. namespace Symfony\Component\Console\Helper;
  34507. use Symfony\Component\Console\Input\InputAwareInterface;
  34508. use Symfony\Component\Console\Input\InputInterface;
  34509. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  34510. {
  34511. protected $input;
  34512. public function setInput(InputInterface $input)
  34513. {
  34514. $this->input = $input;
  34515. }
  34516. }
  34517. <?php
  34518. namespace Symfony\Component\Console\Helper;
  34519. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34520. use Symfony\Component\Console\Output\OutputInterface;
  34521. use Symfony\Component\Process\Exception\ProcessFailedException;
  34522. use Symfony\Component\Process\Process;
  34523. use Symfony\Component\Process\ProcessBuilder;
  34524. class ProcessHelper extends Helper
  34525. {
  34526. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  34527. {
  34528. if ($output instanceof ConsoleOutputInterface) {
  34529. $output = $output->getErrorOutput();
  34530. }
  34531. $formatter = $this->getHelperSet()->get('debug_formatter');
  34532. if (\is_array($cmd)) {
  34533. $process = ProcessBuilder::create($cmd)->getProcess();
  34534. } elseif ($cmd instanceof Process) {
  34535. $process = $cmd;
  34536. } else {
  34537. $process = new Process($cmd);
  34538. }
  34539. if ($verbosity <= $output->getVerbosity()) {
  34540. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  34541. }
  34542. if ($output->isDebug()) {
  34543. $callback = $this->wrapCallback($output, $process, $callback);
  34544. }
  34545. $process->run($callback);
  34546. if ($verbosity <= $output->getVerbosity()) {
  34547. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  34548. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  34549. }
  34550. if (!$process->isSuccessful() && null !== $error) {
  34551. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  34552. }
  34553. return $process;
  34554. }
  34555. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  34556. {
  34557. $process = $this->run($output, $cmd, $error, $callback);
  34558. if (!$process->isSuccessful()) {
  34559. throw new ProcessFailedException($process);
  34560. }
  34561. return $process;
  34562. }
  34563. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  34564. {
  34565. if ($output instanceof ConsoleOutputInterface) {
  34566. $output = $output->getErrorOutput();
  34567. }
  34568. $formatter = $this->getHelperSet()->get('debug_formatter');
  34569. $that = $this;
  34570. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  34571. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  34572. if (null !== $callback) {
  34573. \call_user_func($callback, $type, $buffer);
  34574. }
  34575. };
  34576. }
  34577. public function escapeString($str)
  34578. {
  34579. return str_replace('<', '\\<', $str);
  34580. }
  34581. public function getName()
  34582. {
  34583. return 'process';
  34584. }
  34585. }
  34586. <?php
  34587. namespace Symfony\Component\Console\Helper;
  34588. use Symfony\Component\Console\Exception\LogicException;
  34589. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34590. use Symfony\Component\Console\Output\OutputInterface;
  34591. class ProgressBar
  34592. {
  34593. private $barWidth = 28;
  34594. private $barChar;
  34595. private $emptyBarChar = '-';
  34596. private $progressChar = '>';
  34597. private $format;
  34598. private $internalFormat;
  34599. private $redrawFreq = 1;
  34600. private $output;
  34601. private $step = 0;
  34602. private $max;
  34603. private $startTime;
  34604. private $stepWidth;
  34605. private $percent = 0.0;
  34606. private $formatLineCount;
  34607. private $messages = array();
  34608. private $overwrite = true;
  34609. private $firstRun = true;
  34610. private static $formatters;
  34611. private static $formats;
  34612. public function __construct(OutputInterface $output, $max = 0)
  34613. {
  34614. if ($output instanceof ConsoleOutputInterface) {
  34615. $output = $output->getErrorOutput();
  34616. }
  34617. $this->output = $output;
  34618. $this->setMaxSteps($max);
  34619. if (!$this->output->isDecorated()) {
  34620. $this->overwrite = false;
  34621. $this->setRedrawFrequency($max / 10);
  34622. }
  34623. $this->startTime = time();
  34624. }
  34625. public static function setPlaceholderFormatterDefinition($name, $callable)
  34626. {
  34627. if (!self::$formatters) {
  34628. self::$formatters = self::initPlaceholderFormatters();
  34629. }
  34630. self::$formatters[$name] = $callable;
  34631. }
  34632. public static function getPlaceholderFormatterDefinition($name)
  34633. {
  34634. if (!self::$formatters) {
  34635. self::$formatters = self::initPlaceholderFormatters();
  34636. }
  34637. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34638. }
  34639. public static function setFormatDefinition($name, $format)
  34640. {
  34641. if (!self::$formats) {
  34642. self::$formats = self::initFormats();
  34643. }
  34644. self::$formats[$name] = $format;
  34645. }
  34646. public static function getFormatDefinition($name)
  34647. {
  34648. if (!self::$formats) {
  34649. self::$formats = self::initFormats();
  34650. }
  34651. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34652. }
  34653. public function setMessage($message, $name = 'message')
  34654. {
  34655. $this->messages[$name] = $message;
  34656. }
  34657. public function getMessage($name = 'message')
  34658. {
  34659. return $this->messages[$name];
  34660. }
  34661. public function getStartTime()
  34662. {
  34663. return $this->startTime;
  34664. }
  34665. public function getMaxSteps()
  34666. {
  34667. return $this->max;
  34668. }
  34669. public function getStep()
  34670. {
  34671. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  34672. return $this->getProgress();
  34673. }
  34674. public function getProgress()
  34675. {
  34676. return $this->step;
  34677. }
  34678. public function getStepWidth()
  34679. {
  34680. return $this->stepWidth;
  34681. }
  34682. public function getProgressPercent()
  34683. {
  34684. return $this->percent;
  34685. }
  34686. public function setBarWidth($size)
  34687. {
  34688. $this->barWidth = (int) $size;
  34689. }
  34690. public function getBarWidth()
  34691. {
  34692. return $this->barWidth;
  34693. }
  34694. public function setBarCharacter($char)
  34695. {
  34696. $this->barChar = $char;
  34697. }
  34698. public function getBarCharacter()
  34699. {
  34700. if (null === $this->barChar) {
  34701. return $this->max ? '=' : $this->emptyBarChar;
  34702. }
  34703. return $this->barChar;
  34704. }
  34705. public function setEmptyBarCharacter($char)
  34706. {
  34707. $this->emptyBarChar = $char;
  34708. }
  34709. public function getEmptyBarCharacter()
  34710. {
  34711. return $this->emptyBarChar;
  34712. }
  34713. public function setProgressCharacter($char)
  34714. {
  34715. $this->progressChar = $char;
  34716. }
  34717. public function getProgressCharacter()
  34718. {
  34719. return $this->progressChar;
  34720. }
  34721. public function setFormat($format)
  34722. {
  34723. $this->format = null;
  34724. $this->internalFormat = $format;
  34725. }
  34726. public function setRedrawFrequency($freq)
  34727. {
  34728. $this->redrawFreq = max((int) $freq, 1);
  34729. }
  34730. public function start($max = null)
  34731. {
  34732. $this->startTime = time();
  34733. $this->step = 0;
  34734. $this->percent = 0.0;
  34735. if (null !== $max) {
  34736. $this->setMaxSteps($max);
  34737. }
  34738. $this->display();
  34739. }
  34740. public function advance($step = 1)
  34741. {
  34742. $this->setProgress($this->step + $step);
  34743. }
  34744. public function setCurrent($step)
  34745. {
  34746. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  34747. $this->setProgress($step);
  34748. }
  34749. public function setOverwrite($overwrite)
  34750. {
  34751. $this->overwrite = (bool) $overwrite;
  34752. }
  34753. public function setProgress($step)
  34754. {
  34755. $step = (int) $step;
  34756. if ($step < $this->step) {
  34757. throw new LogicException('You can\'t regress the progress bar.');
  34758. }
  34759. if ($this->max && $step > $this->max) {
  34760. $this->max = $step;
  34761. }
  34762. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  34763. $currPeriod = (int) ($step / $this->redrawFreq);
  34764. $this->step = $step;
  34765. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  34766. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  34767. $this->display();
  34768. }
  34769. }
  34770. public function finish()
  34771. {
  34772. if (!$this->max) {
  34773. $this->max = $this->step;
  34774. }
  34775. if ($this->step === $this->max && !$this->overwrite) {
  34776. return;
  34777. }
  34778. $this->setProgress($this->max);
  34779. }
  34780. public function display()
  34781. {
  34782. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34783. return;
  34784. }
  34785. if (null === $this->format) {
  34786. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34787. }
  34788. $self = $this;
  34789. $output = $this->output;
  34790. $messages = $this->messages;
  34791. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  34792. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34793. $text = \call_user_func($formatter, $self, $output);
  34794. } elseif (isset($messages[$matches[1]])) {
  34795. $text = $messages[$matches[1]];
  34796. } else {
  34797. return $matches[0];
  34798. }
  34799. if (isset($matches[2])) {
  34800. $text = sprintf('%'.$matches[2], $text);
  34801. }
  34802. return $text;
  34803. }, $this->format));
  34804. }
  34805. public function clear()
  34806. {
  34807. if (!$this->overwrite) {
  34808. return;
  34809. }
  34810. if (null === $this->format) {
  34811. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34812. }
  34813. $this->overwrite('');
  34814. }
  34815. private function setRealFormat($format)
  34816. {
  34817. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34818. $this->format = self::getFormatDefinition($format.'_nomax');
  34819. } elseif (null !== self::getFormatDefinition($format)) {
  34820. $this->format = self::getFormatDefinition($format);
  34821. } else {
  34822. $this->format = $format;
  34823. }
  34824. $this->formatLineCount = substr_count($this->format, "\n");
  34825. }
  34826. private function setMaxSteps($max)
  34827. {
  34828. $this->max = max(0, (int) $max);
  34829. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  34830. }
  34831. private function overwrite($message)
  34832. {
  34833. if ($this->overwrite) {
  34834. if (!$this->firstRun) {
  34835. $this->output->write("\x0D");
  34836. $this->output->write("\x1B[2K");
  34837. if ($this->formatLineCount > 0) {
  34838. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  34839. }
  34840. }
  34841. } elseif ($this->step > 0) {
  34842. $this->output->writeln('');
  34843. }
  34844. $this->firstRun = false;
  34845. $this->output->write($message);
  34846. }
  34847. private function determineBestFormat()
  34848. {
  34849. switch ($this->output->getVerbosity()) {
  34850. case OutputInterface::VERBOSITY_VERBOSE:
  34851. return $this->max ? 'verbose' : 'verbose_nomax';
  34852. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34853. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  34854. case OutputInterface::VERBOSITY_DEBUG:
  34855. return $this->max ? 'debug' : 'debug_nomax';
  34856. default:
  34857. return $this->max ? 'normal' : 'normal_nomax';
  34858. }
  34859. }
  34860. private static function initPlaceholderFormatters()
  34861. {
  34862. return array(
  34863. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  34864. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  34865. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  34866. if ($completeBars < $bar->getBarWidth()) {
  34867. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  34868. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  34869. }
  34870. return $display;
  34871. },
  34872. 'elapsed' => function (ProgressBar $bar) {
  34873. return Helper::formatTime(time() - $bar->getStartTime());
  34874. },
  34875. 'remaining' => function (ProgressBar $bar) {
  34876. if (!$bar->getMaxSteps()) {
  34877. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  34878. }
  34879. if (!$bar->getProgress()) {
  34880. $remaining = 0;
  34881. } else {
  34882. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  34883. }
  34884. return Helper::formatTime($remaining);
  34885. },
  34886. 'estimated' => function (ProgressBar $bar) {
  34887. if (!$bar->getMaxSteps()) {
  34888. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  34889. }
  34890. if (!$bar->getProgress()) {
  34891. $estimated = 0;
  34892. } else {
  34893. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34894. }
  34895. return Helper::formatTime($estimated);
  34896. },
  34897. 'memory' => function (ProgressBar $bar) {
  34898. return Helper::formatMemory(memory_get_usage(true));
  34899. },
  34900. 'current' => function (ProgressBar $bar) {
  34901. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34902. },
  34903. 'max' => function (ProgressBar $bar) {
  34904. return $bar->getMaxSteps();
  34905. },
  34906. 'percent' => function (ProgressBar $bar) {
  34907. return floor($bar->getProgressPercent() * 100);
  34908. },
  34909. );
  34910. }
  34911. private static function initFormats()
  34912. {
  34913. return array(
  34914. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  34915. 'normal_nomax' => ' %current% [%bar%]',
  34916. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  34917. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34918. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  34919. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34920. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  34921. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  34922. );
  34923. }
  34924. }
  34925. <?php
  34926. namespace Symfony\Component\Console\Helper;
  34927. use Symfony\Component\Console\Exception\LogicException;
  34928. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34929. use Symfony\Component\Console\Output\NullOutput;
  34930. use Symfony\Component\Console\Output\OutputInterface;
  34931. class ProgressHelper extends Helper
  34932. {
  34933. const FORMAT_QUIET = ' %percent%%';
  34934. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  34935. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  34936. const FORMAT_QUIET_NOMAX = ' %current%';
  34937. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  34938. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  34939. private $barWidth = 28;
  34940. private $barChar = '=';
  34941. private $emptyBarChar = '-';
  34942. private $progressChar = '>';
  34943. private $format = null;
  34944. private $redrawFreq = 1;
  34945. private $lastMessagesLength;
  34946. private $barCharOriginal;
  34947. private $output;
  34948. private $current;
  34949. private $max;
  34950. private $startTime;
  34951. private $defaultFormatVars = array(
  34952. 'current',
  34953. 'max',
  34954. 'bar',
  34955. 'percent',
  34956. 'elapsed',
  34957. );
  34958. private $formatVars;
  34959. private $widths = array(
  34960. 'current' => 4,
  34961. 'max' => 4,
  34962. 'percent' => 3,
  34963. 'elapsed' => 6,
  34964. );
  34965. private $timeFormats = array(
  34966. array(0, '???'),
  34967. array(2, '1 sec'),
  34968. array(59, 'secs', 1),
  34969. array(60, '1 min'),
  34970. array(3600, 'mins', 60),
  34971. array(5400, '1 hr'),
  34972. array(86400, 'hrs', 3600),
  34973. array(129600, '1 day'),
  34974. array(604800, 'days', 86400),
  34975. );
  34976. public function __construct($triggerDeprecationError = true)
  34977. {
  34978. if ($triggerDeprecationError) {
  34979. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  34980. }
  34981. }
  34982. public function setBarWidth($size)
  34983. {
  34984. $this->barWidth = (int) $size;
  34985. }
  34986. public function setBarCharacter($char)
  34987. {
  34988. $this->barChar = $char;
  34989. }
  34990. public function setEmptyBarCharacter($char)
  34991. {
  34992. $this->emptyBarChar = $char;
  34993. }
  34994. public function setProgressCharacter($char)
  34995. {
  34996. $this->progressChar = $char;
  34997. }
  34998. public function setFormat($format)
  34999. {
  35000. $this->format = $format;
  35001. }
  35002. public function setRedrawFrequency($freq)
  35003. {
  35004. $this->redrawFreq = (int) $freq;
  35005. }
  35006. public function start(OutputInterface $output, $max = null)
  35007. {
  35008. if ($output instanceof ConsoleOutputInterface) {
  35009. $output = $output->getErrorOutput();
  35010. }
  35011. $this->startTime = time();
  35012. $this->current = 0;
  35013. $this->max = (int) $max;
  35014. $this->output = $output->isDecorated() ? $output : new NullOutput();
  35015. $this->lastMessagesLength = 0;
  35016. $this->barCharOriginal = '';
  35017. if (null === $this->format) {
  35018. switch ($output->getVerbosity()) {
  35019. case OutputInterface::VERBOSITY_QUIET:
  35020. $this->format = self::FORMAT_QUIET_NOMAX;
  35021. if ($this->max > 0) {
  35022. $this->format = self::FORMAT_QUIET;
  35023. }
  35024. break;
  35025. case OutputInterface::VERBOSITY_VERBOSE:
  35026. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35027. case OutputInterface::VERBOSITY_DEBUG:
  35028. $this->format = self::FORMAT_VERBOSE_NOMAX;
  35029. if ($this->max > 0) {
  35030. $this->format = self::FORMAT_VERBOSE;
  35031. }
  35032. break;
  35033. default:
  35034. $this->format = self::FORMAT_NORMAL_NOMAX;
  35035. if ($this->max > 0) {
  35036. $this->format = self::FORMAT_NORMAL;
  35037. }
  35038. break;
  35039. }
  35040. }
  35041. $this->initialize();
  35042. }
  35043. public function advance($step = 1, $redraw = false)
  35044. {
  35045. $this->setCurrent($this->current + $step, $redraw);
  35046. }
  35047. public function setCurrent($current, $redraw = false)
  35048. {
  35049. if (null === $this->startTime) {
  35050. throw new LogicException('You must start the progress bar before calling setCurrent().');
  35051. }
  35052. $current = (int) $current;
  35053. if ($current < $this->current) {
  35054. throw new LogicException('You can\'t regress the progress bar');
  35055. }
  35056. if (0 === $this->current) {
  35057. $redraw = true;
  35058. }
  35059. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  35060. $this->current = $current;
  35061. $currPeriod = (int) ($this->current / $this->redrawFreq);
  35062. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  35063. $this->display();
  35064. }
  35065. }
  35066. public function display($finish = false)
  35067. {
  35068. if (null === $this->startTime) {
  35069. throw new LogicException('You must start the progress bar before calling display().');
  35070. }
  35071. $message = $this->format;
  35072. foreach ($this->generate($finish) as $name => $value) {
  35073. $message = str_replace("%{$name}%", $value, $message);
  35074. }
  35075. $this->overwrite($this->output, $message);
  35076. }
  35077. public function clear()
  35078. {
  35079. $this->overwrite($this->output, '');
  35080. }
  35081. public function finish()
  35082. {
  35083. if (null === $this->startTime) {
  35084. throw new LogicException('You must start the progress bar before calling finish().');
  35085. }
  35086. if (null !== $this->startTime) {
  35087. if (!$this->max) {
  35088. $this->barChar = $this->barCharOriginal;
  35089. $this->display(true);
  35090. }
  35091. $this->startTime = null;
  35092. $this->output->writeln('');
  35093. $this->output = null;
  35094. }
  35095. }
  35096. private function initialize()
  35097. {
  35098. $this->formatVars = array();
  35099. foreach ($this->defaultFormatVars as $var) {
  35100. if (false !== strpos($this->format, "%{$var}%")) {
  35101. $this->formatVars[$var] = true;
  35102. }
  35103. }
  35104. if ($this->max > 0) {
  35105. $this->widths['max'] = $this->strlen($this->max);
  35106. $this->widths['current'] = $this->widths['max'];
  35107. } else {
  35108. $this->barCharOriginal = $this->barChar;
  35109. $this->barChar = $this->emptyBarChar;
  35110. }
  35111. }
  35112. private function generate($finish = false)
  35113. {
  35114. $vars = array();
  35115. $percent = 0;
  35116. if ($this->max > 0) {
  35117. $percent = (float) $this->current / $this->max;
  35118. }
  35119. if (isset($this->formatVars['bar'])) {
  35120. if ($this->max > 0) {
  35121. $completeBars = floor($percent * $this->barWidth);
  35122. } else {
  35123. if (!$finish) {
  35124. $completeBars = floor($this->current % $this->barWidth);
  35125. } else {
  35126. $completeBars = $this->barWidth;
  35127. }
  35128. }
  35129. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  35130. $bar = str_repeat($this->barChar, $completeBars);
  35131. if ($completeBars < $this->barWidth) {
  35132. $bar .= $this->progressChar;
  35133. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  35134. }
  35135. $vars['bar'] = $bar;
  35136. }
  35137. if (isset($this->formatVars['elapsed'])) {
  35138. $elapsed = time() - $this->startTime;
  35139. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  35140. }
  35141. if (isset($this->formatVars['current'])) {
  35142. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  35143. }
  35144. if (isset($this->formatVars['max'])) {
  35145. $vars['max'] = $this->max;
  35146. }
  35147. if (isset($this->formatVars['percent'])) {
  35148. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  35149. }
  35150. return $vars;
  35151. }
  35152. private function humaneTime($secs)
  35153. {
  35154. $text = '';
  35155. foreach ($this->timeFormats as $format) {
  35156. if ($secs < $format[0]) {
  35157. if (2 == \count($format)) {
  35158. $text = $format[1];
  35159. break;
  35160. } else {
  35161. $text = ceil($secs / $format[2]).' '.$format[1];
  35162. break;
  35163. }
  35164. }
  35165. }
  35166. return $text;
  35167. }
  35168. private function overwrite(OutputInterface $output, $message)
  35169. {
  35170. $length = $this->strlen($message);
  35171. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  35172. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  35173. }
  35174. $output->write("\x0D");
  35175. $output->write($message);
  35176. $this->lastMessagesLength = $this->strlen($message);
  35177. }
  35178. public function getName()
  35179. {
  35180. return 'progress';
  35181. }
  35182. }
  35183. <?php
  35184. namespace Symfony\Component\Console\Helper;
  35185. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35186. use Symfony\Component\Console\Exception\LogicException;
  35187. use Symfony\Component\Console\Output\OutputInterface;
  35188. class ProgressIndicator
  35189. {
  35190. private $output;
  35191. private $startTime;
  35192. private $format;
  35193. private $message;
  35194. private $indicatorValues;
  35195. private $indicatorCurrent;
  35196. private $indicatorChangeInterval;
  35197. private $indicatorUpdateTime;
  35198. private $started = false;
  35199. private static $formatters;
  35200. private static $formats;
  35201. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  35202. {
  35203. $this->output = $output;
  35204. if (null === $format) {
  35205. $format = $this->determineBestFormat();
  35206. }
  35207. if (null === $indicatorValues) {
  35208. $indicatorValues = array('-', '\\', '|', '/');
  35209. }
  35210. $indicatorValues = array_values($indicatorValues);
  35211. if (2 > \count($indicatorValues)) {
  35212. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  35213. }
  35214. $this->format = self::getFormatDefinition($format);
  35215. $this->indicatorChangeInterval = $indicatorChangeInterval;
  35216. $this->indicatorValues = $indicatorValues;
  35217. $this->startTime = time();
  35218. }
  35219. public function setMessage($message)
  35220. {
  35221. $this->message = $message;
  35222. $this->display();
  35223. }
  35224. public function getMessage()
  35225. {
  35226. return $this->message;
  35227. }
  35228. public function getStartTime()
  35229. {
  35230. return $this->startTime;
  35231. }
  35232. public function getCurrentValue()
  35233. {
  35234. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  35235. }
  35236. public function start($message)
  35237. {
  35238. if ($this->started) {
  35239. throw new LogicException('Progress indicator already started.');
  35240. }
  35241. $this->message = $message;
  35242. $this->started = true;
  35243. $this->startTime = time();
  35244. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  35245. $this->indicatorCurrent = 0;
  35246. $this->display();
  35247. }
  35248. public function advance()
  35249. {
  35250. if (!$this->started) {
  35251. throw new LogicException('Progress indicator has not yet been started.');
  35252. }
  35253. if (!$this->output->isDecorated()) {
  35254. return;
  35255. }
  35256. $currentTime = $this->getCurrentTimeInMilliseconds();
  35257. if ($currentTime < $this->indicatorUpdateTime) {
  35258. return;
  35259. }
  35260. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  35261. ++$this->indicatorCurrent;
  35262. $this->display();
  35263. }
  35264. public function finish($message)
  35265. {
  35266. if (!$this->started) {
  35267. throw new LogicException('Progress indicator has not yet been started.');
  35268. }
  35269. $this->message = $message;
  35270. $this->display();
  35271. $this->output->writeln('');
  35272. $this->started = false;
  35273. }
  35274. public static function getFormatDefinition($name)
  35275. {
  35276. if (!self::$formats) {
  35277. self::$formats = self::initFormats();
  35278. }
  35279. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  35280. }
  35281. public static function setPlaceholderFormatterDefinition($name, $callable)
  35282. {
  35283. if (!self::$formatters) {
  35284. self::$formatters = self::initPlaceholderFormatters();
  35285. }
  35286. self::$formatters[$name] = $callable;
  35287. }
  35288. public static function getPlaceholderFormatterDefinition($name)
  35289. {
  35290. if (!self::$formatters) {
  35291. self::$formatters = self::initPlaceholderFormatters();
  35292. }
  35293. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  35294. }
  35295. private function display()
  35296. {
  35297. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  35298. return;
  35299. }
  35300. $self = $this;
  35301. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  35302. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  35303. return \call_user_func($formatter, $self);
  35304. }
  35305. return $matches[0];
  35306. }, $this->format));
  35307. }
  35308. private function determineBestFormat()
  35309. {
  35310. switch ($this->output->getVerbosity()) {
  35311. case OutputInterface::VERBOSITY_VERBOSE:
  35312. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  35313. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35314. case OutputInterface::VERBOSITY_DEBUG:
  35315. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  35316. default:
  35317. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  35318. }
  35319. }
  35320. private function overwrite($message)
  35321. {
  35322. if ($this->output->isDecorated()) {
  35323. $this->output->write("\x0D\x1B[2K");
  35324. $this->output->write($message);
  35325. } else {
  35326. $this->output->writeln($message);
  35327. }
  35328. }
  35329. private function getCurrentTimeInMilliseconds()
  35330. {
  35331. return round(microtime(true) * 1000);
  35332. }
  35333. private static function initPlaceholderFormatters()
  35334. {
  35335. return array(
  35336. 'indicator' => function (ProgressIndicator $indicator) {
  35337. return $indicator->getCurrentValue();
  35338. },
  35339. 'message' => function (ProgressIndicator $indicator) {
  35340. return $indicator->getMessage();
  35341. },
  35342. 'elapsed' => function (ProgressIndicator $indicator) {
  35343. return Helper::formatTime(time() - $indicator->getStartTime());
  35344. },
  35345. 'memory' => function () {
  35346. return Helper::formatMemory(memory_get_usage(true));
  35347. },
  35348. );
  35349. }
  35350. private static function initFormats()
  35351. {
  35352. return array(
  35353. 'normal' => ' %indicator% %message%',
  35354. 'normal_no_ansi' => ' %message%',
  35355. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  35356. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  35357. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  35358. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  35359. );
  35360. }
  35361. }
  35362. <?php
  35363. namespace Symfony\Component\Console\Helper;
  35364. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35365. use Symfony\Component\Console\Exception\RuntimeException;
  35366. use Symfony\Component\Console\Formatter\OutputFormatter;
  35367. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35368. use Symfony\Component\Console\Input\InputInterface;
  35369. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35370. use Symfony\Component\Console\Output\OutputInterface;
  35371. use Symfony\Component\Console\Question\ChoiceQuestion;
  35372. use Symfony\Component\Console\Question\Question;
  35373. class QuestionHelper extends Helper
  35374. {
  35375. private $inputStream;
  35376. private static $shell;
  35377. private static $stty;
  35378. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35379. {
  35380. if ($output instanceof ConsoleOutputInterface) {
  35381. $output = $output->getErrorOutput();
  35382. }
  35383. if (!$input->isInteractive()) {
  35384. $default = $question->getDefault();
  35385. if (null !== $default && $question instanceof ChoiceQuestion) {
  35386. $choices = $question->getChoices();
  35387. if (!$question->isMultiselect()) {
  35388. return isset($choices[$default]) ? $choices[$default] : $default;
  35389. }
  35390. $default = explode(',', $default);
  35391. foreach ($default as $k => $v) {
  35392. $v = trim($v);
  35393. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  35394. }
  35395. }
  35396. return $default;
  35397. }
  35398. if (!$question->getValidator()) {
  35399. return $this->doAsk($output, $question);
  35400. }
  35401. $that = $this;
  35402. $interviewer = function () use ($output, $question, $that) {
  35403. return $that->doAsk($output, $question);
  35404. };
  35405. return $this->validateAttempts($interviewer, $output, $question);
  35406. }
  35407. public function setInputStream($stream)
  35408. {
  35409. if (!\is_resource($stream)) {
  35410. throw new InvalidArgumentException('Input stream must be a valid resource.');
  35411. }
  35412. $this->inputStream = $stream;
  35413. }
  35414. public function getInputStream()
  35415. {
  35416. return $this->inputStream;
  35417. }
  35418. public function getName()
  35419. {
  35420. return 'question';
  35421. }
  35422. public function doAsk(OutputInterface $output, Question $question)
  35423. {
  35424. $this->writePrompt($output, $question);
  35425. $inputStream = $this->inputStream ?: STDIN;
  35426. $autocomplete = $question->getAutocompleterValues();
  35427. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35428. $ret = false;
  35429. if ($question->isHidden()) {
  35430. try {
  35431. $ret = trim($this->getHiddenResponse($output, $inputStream));
  35432. } catch (RuntimeException $e) {
  35433. if (!$question->isHiddenFallback()) {
  35434. throw $e;
  35435. }
  35436. }
  35437. }
  35438. if (false === $ret) {
  35439. $ret = fgets($inputStream, 4096);
  35440. if (false === $ret) {
  35441. throw new RuntimeException('Aborted');
  35442. }
  35443. $ret = trim($ret);
  35444. }
  35445. } else {
  35446. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  35447. }
  35448. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  35449. if ($normalizer = $question->getNormalizer()) {
  35450. return $normalizer($ret);
  35451. }
  35452. return $ret;
  35453. }
  35454. protected function writePrompt(OutputInterface $output, Question $question)
  35455. {
  35456. $message = $question->getQuestion();
  35457. if ($question instanceof ChoiceQuestion) {
  35458. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  35459. $messages = (array) $question->getQuestion();
  35460. foreach ($question->getChoices() as $key => $value) {
  35461. $width = $maxWidth - $this->strlen($key);
  35462. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  35463. }
  35464. $output->writeln($messages);
  35465. $message = $question->getPrompt();
  35466. }
  35467. $output->write($message);
  35468. }
  35469. protected function writeError(OutputInterface $output, \Exception $error)
  35470. {
  35471. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  35472. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  35473. } else {
  35474. $message = '<error>'.$error->getMessage().'</error>';
  35475. }
  35476. $output->writeln($message);
  35477. }
  35478. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  35479. {
  35480. $ret = '';
  35481. $i = 0;
  35482. $ofs = -1;
  35483. $matches = $autocomplete;
  35484. $numMatches = \count($matches);
  35485. $sttyMode = shell_exec('stty -g');
  35486. shell_exec('stty -icanon -echo');
  35487. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35488. while (!feof($inputStream)) {
  35489. $c = fread($inputStream, 1);
  35490. if ("\177" === $c) {
  35491. if (0 === $numMatches && 0 !== $i) {
  35492. --$i;
  35493. $output->write("\033[1D");
  35494. }
  35495. if (0 === $i) {
  35496. $ofs = -1;
  35497. $matches = $autocomplete;
  35498. $numMatches = \count($matches);
  35499. } else {
  35500. $numMatches = 0;
  35501. }
  35502. $ret = substr($ret, 0, $i);
  35503. } elseif ("\033" === $c) {
  35504. $c .= fread($inputStream, 2);
  35505. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35506. if ('A' === $c[2] && -1 === $ofs) {
  35507. $ofs = 0;
  35508. }
  35509. if (0 === $numMatches) {
  35510. continue;
  35511. }
  35512. $ofs += ('A' === $c[2]) ? -1 : 1;
  35513. $ofs = ($numMatches + $ofs) % $numMatches;
  35514. }
  35515. } elseif (\ord($c) < 32) {
  35516. if ("\t" === $c || "\n" === $c) {
  35517. if ($numMatches > 0 && -1 !== $ofs) {
  35518. $ret = $matches[$ofs];
  35519. $output->write(substr($ret, $i));
  35520. $i = \strlen($ret);
  35521. }
  35522. if ("\n" === $c) {
  35523. $output->write($c);
  35524. break;
  35525. }
  35526. $numMatches = 0;
  35527. }
  35528. continue;
  35529. } else {
  35530. $output->write($c);
  35531. $ret .= $c;
  35532. ++$i;
  35533. $numMatches = 0;
  35534. $ofs = 0;
  35535. foreach ($autocomplete as $value) {
  35536. if (0 === strpos($value, $ret)) {
  35537. $matches[$numMatches++] = $value;
  35538. }
  35539. }
  35540. }
  35541. $output->write("\033[K");
  35542. if ($numMatches > 0 && -1 !== $ofs) {
  35543. $output->write("\0337");
  35544. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  35545. $output->write("\0338");
  35546. }
  35547. }
  35548. shell_exec(sprintf('stty %s', $sttyMode));
  35549. return $ret;
  35550. }
  35551. private function getHiddenResponse(OutputInterface $output, $inputStream)
  35552. {
  35553. if ('\\' === \DIRECTORY_SEPARATOR) {
  35554. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35555. if ('phar:' === substr(__FILE__, 0, 5)) {
  35556. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35557. copy($exe, $tmpExe);
  35558. $exe = $tmpExe;
  35559. }
  35560. $value = rtrim(shell_exec($exe));
  35561. $output->writeln('');
  35562. if (isset($tmpExe)) {
  35563. unlink($tmpExe);
  35564. }
  35565. return $value;
  35566. }
  35567. if ($this->hasSttyAvailable()) {
  35568. $sttyMode = shell_exec('stty -g');
  35569. shell_exec('stty -echo');
  35570. $value = fgets($inputStream, 4096);
  35571. shell_exec(sprintf('stty %s', $sttyMode));
  35572. if (false === $value) {
  35573. throw new RuntimeException('Aborted');
  35574. }
  35575. $value = trim($value);
  35576. $output->writeln('');
  35577. return $value;
  35578. }
  35579. if (false !== $shell = $this->getShell()) {
  35580. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35581. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35582. $value = rtrim(shell_exec($command));
  35583. $output->writeln('');
  35584. return $value;
  35585. }
  35586. throw new RuntimeException('Unable to hide the response.');
  35587. }
  35588. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  35589. {
  35590. $error = null;
  35591. $attempts = $question->getMaxAttempts();
  35592. while (null === $attempts || $attempts--) {
  35593. if (null !== $error) {
  35594. $this->writeError($output, $error);
  35595. }
  35596. try {
  35597. return \call_user_func($question->getValidator(), $interviewer());
  35598. } catch (RuntimeException $e) {
  35599. throw $e;
  35600. } catch (\Exception $error) {
  35601. }
  35602. }
  35603. throw $error;
  35604. }
  35605. private function getShell()
  35606. {
  35607. if (null !== self::$shell) {
  35608. return self::$shell;
  35609. }
  35610. self::$shell = false;
  35611. if (file_exists('/usr/bin/env')) {
  35612. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35613. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35614. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35615. self::$shell = $sh;
  35616. break;
  35617. }
  35618. }
  35619. }
  35620. return self::$shell;
  35621. }
  35622. private function hasSttyAvailable()
  35623. {
  35624. if (null !== self::$stty) {
  35625. return self::$stty;
  35626. }
  35627. exec('stty 2>&1', $output, $exitcode);
  35628. return self::$stty = 0 === $exitcode;
  35629. }
  35630. }
  35631. <?php
  35632. namespace Symfony\Component\Console\Helper;
  35633. use Symfony\Component\Console\Exception\LogicException;
  35634. use Symfony\Component\Console\Formatter\OutputFormatter;
  35635. use Symfony\Component\Console\Input\InputInterface;
  35636. use Symfony\Component\Console\Output\OutputInterface;
  35637. use Symfony\Component\Console\Question\ChoiceQuestion;
  35638. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35639. use Symfony\Component\Console\Question\Question;
  35640. use Symfony\Component\Console\Style\SymfonyStyle;
  35641. class SymfonyQuestionHelper extends QuestionHelper
  35642. {
  35643. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35644. {
  35645. $validator = $question->getValidator();
  35646. $question->setValidator(function ($value) use ($validator) {
  35647. if (null !== $validator) {
  35648. $value = $validator($value);
  35649. } else {
  35650. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  35651. throw new LogicException('A value is required.');
  35652. }
  35653. }
  35654. return $value;
  35655. });
  35656. return parent::ask($input, $output, $question);
  35657. }
  35658. protected function writePrompt(OutputInterface $output, Question $question)
  35659. {
  35660. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  35661. $default = $question->getDefault();
  35662. switch (true) {
  35663. case null === $default:
  35664. $text = sprintf(' <info>%s</info>:', $text);
  35665. break;
  35666. case $question instanceof ConfirmationQuestion:
  35667. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  35668. break;
  35669. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  35670. $choices = $question->getChoices();
  35671. $default = explode(',', $default);
  35672. foreach ($default as $key => $value) {
  35673. $default[$key] = $choices[trim($value)];
  35674. }
  35675. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  35676. break;
  35677. case $question instanceof ChoiceQuestion:
  35678. $choices = $question->getChoices();
  35679. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  35680. break;
  35681. default:
  35682. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  35683. }
  35684. $output->writeln($text);
  35685. if ($question instanceof ChoiceQuestion) {
  35686. $width = max(array_map('strlen', array_keys($question->getChoices())));
  35687. foreach ($question->getChoices() as $key => $value) {
  35688. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  35689. }
  35690. }
  35691. $output->write(' > ');
  35692. }
  35693. protected function writeError(OutputInterface $output, \Exception $error)
  35694. {
  35695. if ($output instanceof SymfonyStyle) {
  35696. $output->newLine();
  35697. $output->error($error->getMessage());
  35698. return;
  35699. }
  35700. parent::writeError($output, $error);
  35701. }
  35702. }
  35703. <?php
  35704. namespace Symfony\Component\Console\Helper;
  35705. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35706. use Symfony\Component\Console\Output\OutputInterface;
  35707. class Table
  35708. {
  35709. private $headers = array();
  35710. private $rows = array();
  35711. private $columnWidths = array();
  35712. private $numberOfColumns;
  35713. private $output;
  35714. private $style;
  35715. private $columnStyles = array();
  35716. private static $styles;
  35717. public function __construct(OutputInterface $output)
  35718. {
  35719. $this->output = $output;
  35720. if (!self::$styles) {
  35721. self::$styles = self::initStyles();
  35722. }
  35723. $this->setStyle('default');
  35724. }
  35725. public static function setStyleDefinition($name, TableStyle $style)
  35726. {
  35727. if (!self::$styles) {
  35728. self::$styles = self::initStyles();
  35729. }
  35730. self::$styles[$name] = $style;
  35731. }
  35732. public static function getStyleDefinition($name)
  35733. {
  35734. if (!self::$styles) {
  35735. self::$styles = self::initStyles();
  35736. }
  35737. if (isset(self::$styles[$name])) {
  35738. return self::$styles[$name];
  35739. }
  35740. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35741. }
  35742. public function setStyle($name)
  35743. {
  35744. $this->style = $this->resolveStyle($name);
  35745. return $this;
  35746. }
  35747. public function getStyle()
  35748. {
  35749. return $this->style;
  35750. }
  35751. public function setColumnStyle($columnIndex, $name)
  35752. {
  35753. $columnIndex = (int) $columnIndex;
  35754. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  35755. return $this;
  35756. }
  35757. public function getColumnStyle($columnIndex)
  35758. {
  35759. if (isset($this->columnStyles[$columnIndex])) {
  35760. return $this->columnStyles[$columnIndex];
  35761. }
  35762. return $this->getStyle();
  35763. }
  35764. public function setHeaders(array $headers)
  35765. {
  35766. $headers = array_values($headers);
  35767. if (!empty($headers) && !\is_array($headers[0])) {
  35768. $headers = array($headers);
  35769. }
  35770. $this->headers = $headers;
  35771. return $this;
  35772. }
  35773. public function setRows(array $rows)
  35774. {
  35775. $this->rows = array();
  35776. return $this->addRows($rows);
  35777. }
  35778. public function addRows(array $rows)
  35779. {
  35780. foreach ($rows as $row) {
  35781. $this->addRow($row);
  35782. }
  35783. return $this;
  35784. }
  35785. public function addRow($row)
  35786. {
  35787. if ($row instanceof TableSeparator) {
  35788. $this->rows[] = $row;
  35789. return $this;
  35790. }
  35791. if (!\is_array($row)) {
  35792. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  35793. }
  35794. $this->rows[] = array_values($row);
  35795. return $this;
  35796. }
  35797. public function setRow($column, array $row)
  35798. {
  35799. $this->rows[$column] = $row;
  35800. return $this;
  35801. }
  35802. public function render()
  35803. {
  35804. $this->calculateNumberOfColumns();
  35805. $rows = $this->buildTableRows($this->rows);
  35806. $headers = $this->buildTableRows($this->headers);
  35807. $this->calculateColumnsWidth(array_merge($headers, $rows));
  35808. $this->renderRowSeparator();
  35809. if (!empty($headers)) {
  35810. foreach ($headers as $header) {
  35811. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35812. $this->renderRowSeparator();
  35813. }
  35814. }
  35815. foreach ($rows as $row) {
  35816. if ($row instanceof TableSeparator) {
  35817. $this->renderRowSeparator();
  35818. } else {
  35819. $this->renderRow($row, $this->style->getCellRowFormat());
  35820. }
  35821. }
  35822. if (!empty($rows)) {
  35823. $this->renderRowSeparator();
  35824. }
  35825. $this->cleanup();
  35826. }
  35827. private function renderRowSeparator()
  35828. {
  35829. if (0 === $count = $this->numberOfColumns) {
  35830. return;
  35831. }
  35832. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  35833. return;
  35834. }
  35835. $markup = $this->style->getCrossingChar();
  35836. for ($column = 0; $column < $count; ++$column) {
  35837. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  35838. }
  35839. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  35840. }
  35841. private function renderColumnSeparator()
  35842. {
  35843. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  35844. }
  35845. private function renderRow(array $row, $cellFormat)
  35846. {
  35847. if (empty($row)) {
  35848. return;
  35849. }
  35850. $rowContent = $this->renderColumnSeparator();
  35851. foreach ($this->getRowColumns($row) as $column) {
  35852. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  35853. $rowContent .= $this->renderColumnSeparator();
  35854. }
  35855. $this->output->writeln($rowContent);
  35856. }
  35857. private function renderCell(array $row, $column, $cellFormat)
  35858. {
  35859. $cell = isset($row[$column]) ? $row[$column] : '';
  35860. $width = $this->columnWidths[$column];
  35861. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35862. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  35863. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  35864. }
  35865. }
  35866. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  35867. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  35868. }
  35869. $style = $this->getColumnStyle($column);
  35870. if ($cell instanceof TableSeparator) {
  35871. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  35872. }
  35873. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35874. $content = sprintf($style->getCellRowContentFormat(), $cell);
  35875. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  35876. }
  35877. private function calculateNumberOfColumns()
  35878. {
  35879. if (null !== $this->numberOfColumns) {
  35880. return;
  35881. }
  35882. $columns = array(0);
  35883. foreach (array_merge($this->headers, $this->rows) as $row) {
  35884. if ($row instanceof TableSeparator) {
  35885. continue;
  35886. }
  35887. $columns[] = $this->getNumberOfColumns($row);
  35888. }
  35889. $this->numberOfColumns = max($columns);
  35890. }
  35891. private function buildTableRows($rows)
  35892. {
  35893. $unmergedRows = array();
  35894. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  35895. $rows = $this->fillNextRows($rows, $rowKey);
  35896. foreach ($rows[$rowKey] as $column => $cell) {
  35897. if (!strstr($cell, "\n")) {
  35898. continue;
  35899. }
  35900. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35901. foreach ($lines as $lineKey => $line) {
  35902. if ($cell instanceof TableCell) {
  35903. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35904. }
  35905. if (0 === $lineKey) {
  35906. $rows[$rowKey][$column] = $line;
  35907. } else {
  35908. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35909. }
  35910. }
  35911. }
  35912. }
  35913. $tableRows = array();
  35914. foreach ($rows as $rowKey => $row) {
  35915. $tableRows[] = $this->fillCells($row);
  35916. if (isset($unmergedRows[$rowKey])) {
  35917. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  35918. }
  35919. }
  35920. return $tableRows;
  35921. }
  35922. private function fillNextRows(array $rows, $line)
  35923. {
  35924. $unmergedRows = array();
  35925. foreach ($rows[$line] as $column => $cell) {
  35926. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  35927. $nbLines = $cell->getRowspan() - 1;
  35928. $lines = array($cell);
  35929. if (strstr($cell, "\n")) {
  35930. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35931. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  35932. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  35933. unset($lines[0]);
  35934. }
  35935. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  35936. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35937. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  35938. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  35939. if ($nbLines === $unmergedRowKey - $line) {
  35940. break;
  35941. }
  35942. }
  35943. }
  35944. }
  35945. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35946. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  35947. foreach ($unmergedRow as $cellKey => $cell) {
  35948. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  35949. }
  35950. } else {
  35951. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  35952. foreach ($unmergedRow as $column => $cell) {
  35953. if (!empty($cell)) {
  35954. $row[$column] = $unmergedRow[$column];
  35955. }
  35956. }
  35957. array_splice($rows, $unmergedRowKey, 0, array($row));
  35958. }
  35959. }
  35960. return $rows;
  35961. }
  35962. private function fillCells($row)
  35963. {
  35964. $newRow = array();
  35965. foreach ($row as $column => $cell) {
  35966. $newRow[] = $cell;
  35967. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35968. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  35969. $newRow[] = '';
  35970. }
  35971. }
  35972. }
  35973. return $newRow ?: $row;
  35974. }
  35975. private function copyRow(array $rows, $line)
  35976. {
  35977. $row = $rows[$line];
  35978. foreach ($row as $cellKey => $cellValue) {
  35979. $row[$cellKey] = '';
  35980. if ($cellValue instanceof TableCell) {
  35981. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  35982. }
  35983. }
  35984. return $row;
  35985. }
  35986. private function getNumberOfColumns(array $row)
  35987. {
  35988. $columns = \count($row);
  35989. foreach ($row as $column) {
  35990. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  35991. }
  35992. return $columns;
  35993. }
  35994. private function getRowColumns(array $row)
  35995. {
  35996. $columns = range(0, $this->numberOfColumns - 1);
  35997. foreach ($row as $cellKey => $cell) {
  35998. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35999. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  36000. }
  36001. }
  36002. return $columns;
  36003. }
  36004. private function calculateColumnsWidth($rows)
  36005. {
  36006. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  36007. $lengths = array();
  36008. foreach ($rows as $row) {
  36009. if ($row instanceof TableSeparator) {
  36010. continue;
  36011. }
  36012. foreach ($row as $i => $cell) {
  36013. if ($cell instanceof TableCell) {
  36014. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  36015. $textLength = Helper::strlen($textContent);
  36016. if ($textLength > 0) {
  36017. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  36018. foreach ($contentColumns as $position => $content) {
  36019. $row[$i + $position] = $content;
  36020. }
  36021. }
  36022. }
  36023. }
  36024. $lengths[] = $this->getCellWidth($row, $column);
  36025. }
  36026. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  36027. }
  36028. }
  36029. private function getColumnSeparatorWidth()
  36030. {
  36031. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  36032. }
  36033. private function getCellWidth(array $row, $column)
  36034. {
  36035. if (isset($row[$column])) {
  36036. $cell = $row[$column];
  36037. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  36038. return $cellWidth;
  36039. }
  36040. return 0;
  36041. }
  36042. private function cleanup()
  36043. {
  36044. $this->columnWidths = array();
  36045. $this->numberOfColumns = null;
  36046. }
  36047. private static function initStyles()
  36048. {
  36049. $borderless = new TableStyle();
  36050. $borderless
  36051. ->setHorizontalBorderChar('=')
  36052. ->setVerticalBorderChar(' ')
  36053. ->setCrossingChar(' ')
  36054. ;
  36055. $compact = new TableStyle();
  36056. $compact
  36057. ->setHorizontalBorderChar('')
  36058. ->setVerticalBorderChar(' ')
  36059. ->setCrossingChar('')
  36060. ->setCellRowContentFormat('%s')
  36061. ;
  36062. $styleGuide = new TableStyle();
  36063. $styleGuide
  36064. ->setHorizontalBorderChar('-')
  36065. ->setVerticalBorderChar(' ')
  36066. ->setCrossingChar(' ')
  36067. ->setCellHeaderFormat('%s')
  36068. ;
  36069. return array(
  36070. 'default' => new TableStyle(),
  36071. 'borderless' => $borderless,
  36072. 'compact' => $compact,
  36073. 'symfony-style-guide' => $styleGuide,
  36074. );
  36075. }
  36076. private function resolveStyle($name)
  36077. {
  36078. if ($name instanceof TableStyle) {
  36079. return $name;
  36080. }
  36081. if (isset(self::$styles[$name])) {
  36082. return self::$styles[$name];
  36083. }
  36084. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  36085. }
  36086. }
  36087. <?php
  36088. namespace Symfony\Component\Console\Helper;
  36089. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36090. class TableCell
  36091. {
  36092. private $value;
  36093. private $options = array(
  36094. 'rowspan' => 1,
  36095. 'colspan' => 1,
  36096. );
  36097. public function __construct($value = '', array $options = array())
  36098. {
  36099. if (is_numeric($value) && !\is_string($value)) {
  36100. $value = (string) $value;
  36101. }
  36102. $this->value = $value;
  36103. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  36104. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  36105. }
  36106. $this->options = array_merge($this->options, $options);
  36107. }
  36108. public function __toString()
  36109. {
  36110. return $this->value;
  36111. }
  36112. public function getColspan()
  36113. {
  36114. return (int) $this->options['colspan'];
  36115. }
  36116. public function getRowspan()
  36117. {
  36118. return (int) $this->options['rowspan'];
  36119. }
  36120. }
  36121. <?php
  36122. namespace Symfony\Component\Console\Helper;
  36123. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36124. use Symfony\Component\Console\Output\NullOutput;
  36125. use Symfony\Component\Console\Output\OutputInterface;
  36126. class TableHelper extends Helper
  36127. {
  36128. const LAYOUT_DEFAULT = 0;
  36129. const LAYOUT_BORDERLESS = 1;
  36130. const LAYOUT_COMPACT = 2;
  36131. private $table;
  36132. public function __construct($triggerDeprecationError = true)
  36133. {
  36134. if ($triggerDeprecationError) {
  36135. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  36136. }
  36137. $this->table = new Table(new NullOutput());
  36138. }
  36139. public function setLayout($layout)
  36140. {
  36141. switch ($layout) {
  36142. case self::LAYOUT_BORDERLESS:
  36143. $this->table->setStyle('borderless');
  36144. break;
  36145. case self::LAYOUT_COMPACT:
  36146. $this->table->setStyle('compact');
  36147. break;
  36148. case self::LAYOUT_DEFAULT:
  36149. $this->table->setStyle('default');
  36150. break;
  36151. default:
  36152. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  36153. }
  36154. return $this;
  36155. }
  36156. public function setHeaders(array $headers)
  36157. {
  36158. $this->table->setHeaders($headers);
  36159. return $this;
  36160. }
  36161. public function setRows(array $rows)
  36162. {
  36163. $this->table->setRows($rows);
  36164. return $this;
  36165. }
  36166. public function addRows(array $rows)
  36167. {
  36168. $this->table->addRows($rows);
  36169. return $this;
  36170. }
  36171. public function addRow(array $row)
  36172. {
  36173. $this->table->addRow($row);
  36174. return $this;
  36175. }
  36176. public function setRow($column, array $row)
  36177. {
  36178. $this->table->setRow($column, $row);
  36179. return $this;
  36180. }
  36181. public function setPaddingChar($paddingChar)
  36182. {
  36183. $this->table->getStyle()->setPaddingChar($paddingChar);
  36184. return $this;
  36185. }
  36186. public function setHorizontalBorderChar($horizontalBorderChar)
  36187. {
  36188. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  36189. return $this;
  36190. }
  36191. public function setVerticalBorderChar($verticalBorderChar)
  36192. {
  36193. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  36194. return $this;
  36195. }
  36196. public function setCrossingChar($crossingChar)
  36197. {
  36198. $this->table->getStyle()->setCrossingChar($crossingChar);
  36199. return $this;
  36200. }
  36201. public function setCellHeaderFormat($cellHeaderFormat)
  36202. {
  36203. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  36204. return $this;
  36205. }
  36206. public function setCellRowFormat($cellRowFormat)
  36207. {
  36208. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  36209. return $this;
  36210. }
  36211. public function setCellRowContentFormat($cellRowContentFormat)
  36212. {
  36213. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  36214. return $this;
  36215. }
  36216. public function setBorderFormat($borderFormat)
  36217. {
  36218. $this->table->getStyle()->setBorderFormat($borderFormat);
  36219. return $this;
  36220. }
  36221. public function setPadType($padType)
  36222. {
  36223. $this->table->getStyle()->setPadType($padType);
  36224. return $this;
  36225. }
  36226. public function render(OutputInterface $output)
  36227. {
  36228. $p = new \ReflectionProperty($this->table, 'output');
  36229. $p->setAccessible(true);
  36230. $p->setValue($this->table, $output);
  36231. $this->table->render();
  36232. }
  36233. public function getName()
  36234. {
  36235. return 'table';
  36236. }
  36237. }
  36238. <?php
  36239. namespace Symfony\Component\Console\Helper;
  36240. class TableSeparator extends TableCell
  36241. {
  36242. public function __construct(array $options = array())
  36243. {
  36244. parent::__construct('', $options);
  36245. }
  36246. }
  36247. <?php
  36248. namespace Symfony\Component\Console\Helper;
  36249. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36250. use Symfony\Component\Console\Exception\LogicException;
  36251. class TableStyle
  36252. {
  36253. private $paddingChar = ' ';
  36254. private $horizontalBorderChar = '-';
  36255. private $verticalBorderChar = '|';
  36256. private $crossingChar = '+';
  36257. private $cellHeaderFormat = '<info>%s</info>';
  36258. private $cellRowFormat = '%s';
  36259. private $cellRowContentFormat = ' %s ';
  36260. private $borderFormat = '%s';
  36261. private $padType = STR_PAD_RIGHT;
  36262. public function setPaddingChar($paddingChar)
  36263. {
  36264. if (!$paddingChar) {
  36265. throw new LogicException('The padding char must not be empty');
  36266. }
  36267. $this->paddingChar = $paddingChar;
  36268. return $this;
  36269. }
  36270. public function getPaddingChar()
  36271. {
  36272. return $this->paddingChar;
  36273. }
  36274. public function setHorizontalBorderChar($horizontalBorderChar)
  36275. {
  36276. $this->horizontalBorderChar = $horizontalBorderChar;
  36277. return $this;
  36278. }
  36279. public function getHorizontalBorderChar()
  36280. {
  36281. return $this->horizontalBorderChar;
  36282. }
  36283. public function setVerticalBorderChar($verticalBorderChar)
  36284. {
  36285. $this->verticalBorderChar = $verticalBorderChar;
  36286. return $this;
  36287. }
  36288. public function getVerticalBorderChar()
  36289. {
  36290. return $this->verticalBorderChar;
  36291. }
  36292. public function setCrossingChar($crossingChar)
  36293. {
  36294. $this->crossingChar = $crossingChar;
  36295. return $this;
  36296. }
  36297. public function getCrossingChar()
  36298. {
  36299. return $this->crossingChar;
  36300. }
  36301. public function setCellHeaderFormat($cellHeaderFormat)
  36302. {
  36303. $this->cellHeaderFormat = $cellHeaderFormat;
  36304. return $this;
  36305. }
  36306. public function getCellHeaderFormat()
  36307. {
  36308. return $this->cellHeaderFormat;
  36309. }
  36310. public function setCellRowFormat($cellRowFormat)
  36311. {
  36312. $this->cellRowFormat = $cellRowFormat;
  36313. return $this;
  36314. }
  36315. public function getCellRowFormat()
  36316. {
  36317. return $this->cellRowFormat;
  36318. }
  36319. public function setCellRowContentFormat($cellRowContentFormat)
  36320. {
  36321. $this->cellRowContentFormat = $cellRowContentFormat;
  36322. return $this;
  36323. }
  36324. public function getCellRowContentFormat()
  36325. {
  36326. return $this->cellRowContentFormat;
  36327. }
  36328. public function setBorderFormat($borderFormat)
  36329. {
  36330. $this->borderFormat = $borderFormat;
  36331. return $this;
  36332. }
  36333. public function getBorderFormat()
  36334. {
  36335. return $this->borderFormat;
  36336. }
  36337. public function setPadType($padType)
  36338. {
  36339. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  36340. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  36341. }
  36342. $this->padType = $padType;
  36343. return $this;
  36344. }
  36345. public function getPadType()
  36346. {
  36347. return $this->padType;
  36348. }
  36349. }
  36350. <?php
  36351. namespace Symfony\Component\Console\Input;
  36352. use Symfony\Component\Console\Exception\RuntimeException;
  36353. class ArgvInput extends Input
  36354. {
  36355. private $tokens;
  36356. private $parsed;
  36357. public function __construct(array $argv = null, InputDefinition $definition = null)
  36358. {
  36359. if (null === $argv) {
  36360. $argv = $_SERVER['argv'];
  36361. }
  36362. array_shift($argv);
  36363. $this->tokens = $argv;
  36364. parent::__construct($definition);
  36365. }
  36366. protected function setTokens(array $tokens)
  36367. {
  36368. $this->tokens = $tokens;
  36369. }
  36370. protected function parse()
  36371. {
  36372. $parseOptions = true;
  36373. $this->parsed = $this->tokens;
  36374. while (null !== $token = array_shift($this->parsed)) {
  36375. if ($parseOptions && '' == $token) {
  36376. $this->parseArgument($token);
  36377. } elseif ($parseOptions && '--' == $token) {
  36378. $parseOptions = false;
  36379. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  36380. $this->parseLongOption($token);
  36381. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  36382. $this->parseShortOption($token);
  36383. } else {
  36384. $this->parseArgument($token);
  36385. }
  36386. }
  36387. }
  36388. private function parseShortOption($token)
  36389. {
  36390. $name = substr($token, 1);
  36391. if (\strlen($name) > 1) {
  36392. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  36393. $this->addShortOption($name[0], substr($name, 1));
  36394. } else {
  36395. $this->parseShortOptionSet($name);
  36396. }
  36397. } else {
  36398. $this->addShortOption($name, null);
  36399. }
  36400. }
  36401. private function parseShortOptionSet($name)
  36402. {
  36403. $len = \strlen($name);
  36404. for ($i = 0; $i < $len; ++$i) {
  36405. if (!$this->definition->hasShortcut($name[$i])) {
  36406. $encoding = mb_detect_encoding($name, null, true);
  36407. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  36408. }
  36409. $option = $this->definition->getOptionForShortcut($name[$i]);
  36410. if ($option->acceptValue()) {
  36411. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  36412. break;
  36413. } else {
  36414. $this->addLongOption($option->getName(), null);
  36415. }
  36416. }
  36417. }
  36418. private function parseLongOption($token)
  36419. {
  36420. $name = substr($token, 2);
  36421. if (false !== $pos = strpos($name, '=')) {
  36422. if (0 === \strlen($value = substr($name, $pos + 1))) {
  36423. array_unshift($this->parsed, null);
  36424. }
  36425. $this->addLongOption(substr($name, 0, $pos), $value);
  36426. } else {
  36427. $this->addLongOption($name, null);
  36428. }
  36429. }
  36430. private function parseArgument($token)
  36431. {
  36432. $c = \count($this->arguments);
  36433. if ($this->definition->hasArgument($c)) {
  36434. $arg = $this->definition->getArgument($c);
  36435. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  36436. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  36437. $arg = $this->definition->getArgument($c - 1);
  36438. $this->arguments[$arg->getName()][] = $token;
  36439. } else {
  36440. $all = $this->definition->getArguments();
  36441. if (\count($all)) {
  36442. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  36443. }
  36444. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  36445. }
  36446. }
  36447. private function addShortOption($shortcut, $value)
  36448. {
  36449. if (!$this->definition->hasShortcut($shortcut)) {
  36450. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  36451. }
  36452. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36453. }
  36454. private function addLongOption($name, $value)
  36455. {
  36456. if (!$this->definition->hasOption($name)) {
  36457. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  36458. }
  36459. $option = $this->definition->getOption($name);
  36460. if (!isset($value[0])) {
  36461. $value = null;
  36462. }
  36463. if (null !== $value && !$option->acceptValue()) {
  36464. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  36465. }
  36466. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  36467. $next = array_shift($this->parsed);
  36468. if (isset($next[0]) && '-' !== $next[0]) {
  36469. $value = $next;
  36470. } elseif (empty($next)) {
  36471. $value = null;
  36472. } else {
  36473. array_unshift($this->parsed, $next);
  36474. }
  36475. }
  36476. if (null === $value) {
  36477. if ($option->isValueRequired()) {
  36478. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  36479. }
  36480. if (!$option->isArray()) {
  36481. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36482. }
  36483. }
  36484. if ($option->isArray()) {
  36485. $this->options[$name][] = $value;
  36486. } else {
  36487. $this->options[$name] = $value;
  36488. }
  36489. }
  36490. public function getFirstArgument()
  36491. {
  36492. foreach ($this->tokens as $token) {
  36493. if ($token && '-' === $token[0]) {
  36494. continue;
  36495. }
  36496. return $token;
  36497. }
  36498. }
  36499. public function hasParameterOption($values)
  36500. {
  36501. $values = (array) $values;
  36502. foreach ($this->tokens as $token) {
  36503. foreach ($values as $value) {
  36504. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36505. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  36506. return true;
  36507. }
  36508. }
  36509. }
  36510. return false;
  36511. }
  36512. public function getParameterOption($values, $default = false)
  36513. {
  36514. $values = (array) $values;
  36515. $tokens = $this->tokens;
  36516. while (0 < \count($tokens)) {
  36517. $token = array_shift($tokens);
  36518. foreach ($values as $value) {
  36519. if ($token === $value) {
  36520. return array_shift($tokens);
  36521. }
  36522. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36523. if ('' !== $leading && 0 === strpos($token, $leading)) {
  36524. return substr($token, \strlen($leading));
  36525. }
  36526. }
  36527. }
  36528. return $default;
  36529. }
  36530. public function __toString()
  36531. {
  36532. $self = $this;
  36533. $tokens = array_map(function ($token) use ($self) {
  36534. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  36535. return $match[1].$self->escapeToken($match[2]);
  36536. }
  36537. if ($token && '-' !== $token[0]) {
  36538. return $self->escapeToken($token);
  36539. }
  36540. return $token;
  36541. }, $this->tokens);
  36542. return implode(' ', $tokens);
  36543. }
  36544. }
  36545. <?php
  36546. namespace Symfony\Component\Console\Input;
  36547. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36548. use Symfony\Component\Console\Exception\InvalidOptionException;
  36549. class ArrayInput extends Input
  36550. {
  36551. private $parameters;
  36552. public function __construct(array $parameters, InputDefinition $definition = null)
  36553. {
  36554. $this->parameters = $parameters;
  36555. parent::__construct($definition);
  36556. }
  36557. public function getFirstArgument()
  36558. {
  36559. foreach ($this->parameters as $key => $value) {
  36560. if ($key && '-' === $key[0]) {
  36561. continue;
  36562. }
  36563. return $value;
  36564. }
  36565. }
  36566. public function hasParameterOption($values)
  36567. {
  36568. $values = (array) $values;
  36569. foreach ($this->parameters as $k => $v) {
  36570. if (!\is_int($k)) {
  36571. $v = $k;
  36572. }
  36573. if (\in_array($v, $values)) {
  36574. return true;
  36575. }
  36576. }
  36577. return false;
  36578. }
  36579. public function getParameterOption($values, $default = false)
  36580. {
  36581. $values = (array) $values;
  36582. foreach ($this->parameters as $k => $v) {
  36583. if (\is_int($k)) {
  36584. if (\in_array($v, $values)) {
  36585. return true;
  36586. }
  36587. } elseif (\in_array($k, $values)) {
  36588. return $v;
  36589. }
  36590. }
  36591. return $default;
  36592. }
  36593. public function __toString()
  36594. {
  36595. $params = array();
  36596. foreach ($this->parameters as $param => $val) {
  36597. if ($param && '-' === $param[0]) {
  36598. if (\is_array($val)) {
  36599. foreach ($val as $v) {
  36600. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  36601. }
  36602. } else {
  36603. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  36604. }
  36605. } else {
  36606. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  36607. }
  36608. }
  36609. return implode(' ', $params);
  36610. }
  36611. protected function parse()
  36612. {
  36613. foreach ($this->parameters as $key => $value) {
  36614. if (0 === strpos($key, '--')) {
  36615. $this->addLongOption(substr($key, 2), $value);
  36616. } elseif ('-' === $key[0]) {
  36617. $this->addShortOption(substr($key, 1), $value);
  36618. } else {
  36619. $this->addArgument($key, $value);
  36620. }
  36621. }
  36622. }
  36623. private function addShortOption($shortcut, $value)
  36624. {
  36625. if (!$this->definition->hasShortcut($shortcut)) {
  36626. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  36627. }
  36628. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36629. }
  36630. private function addLongOption($name, $value)
  36631. {
  36632. if (!$this->definition->hasOption($name)) {
  36633. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  36634. }
  36635. $option = $this->definition->getOption($name);
  36636. if (null === $value) {
  36637. if ($option->isValueRequired()) {
  36638. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  36639. }
  36640. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36641. }
  36642. $this->options[$name] = $value;
  36643. }
  36644. private function addArgument($name, $value)
  36645. {
  36646. if (!$this->definition->hasArgument($name)) {
  36647. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36648. }
  36649. $this->arguments[$name] = $value;
  36650. }
  36651. }
  36652. <?php
  36653. namespace Symfony\Component\Console\Input;
  36654. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36655. use Symfony\Component\Console\Exception\RuntimeException;
  36656. abstract class Input implements InputInterface
  36657. {
  36658. protected $definition;
  36659. protected $options = array();
  36660. protected $arguments = array();
  36661. protected $interactive = true;
  36662. public function __construct(InputDefinition $definition = null)
  36663. {
  36664. if (null === $definition) {
  36665. $this->definition = new InputDefinition();
  36666. } else {
  36667. $this->bind($definition);
  36668. $this->validate();
  36669. }
  36670. }
  36671. public function bind(InputDefinition $definition)
  36672. {
  36673. $this->arguments = array();
  36674. $this->options = array();
  36675. $this->definition = $definition;
  36676. $this->parse();
  36677. }
  36678. abstract protected function parse();
  36679. public function validate()
  36680. {
  36681. $definition = $this->definition;
  36682. $givenArguments = $this->arguments;
  36683. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  36684. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  36685. });
  36686. if (\count($missingArguments) > 0) {
  36687. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  36688. }
  36689. }
  36690. public function isInteractive()
  36691. {
  36692. return $this->interactive;
  36693. }
  36694. public function setInteractive($interactive)
  36695. {
  36696. $this->interactive = (bool) $interactive;
  36697. }
  36698. public function getArguments()
  36699. {
  36700. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  36701. }
  36702. public function getArgument($name)
  36703. {
  36704. if (!$this->definition->hasArgument($name)) {
  36705. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36706. }
  36707. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  36708. }
  36709. public function setArgument($name, $value)
  36710. {
  36711. if (!$this->definition->hasArgument($name)) {
  36712. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36713. }
  36714. $this->arguments[$name] = $value;
  36715. }
  36716. public function hasArgument($name)
  36717. {
  36718. return $this->definition->hasArgument($name);
  36719. }
  36720. public function getOptions()
  36721. {
  36722. return array_merge($this->definition->getOptionDefaults(), $this->options);
  36723. }
  36724. public function getOption($name)
  36725. {
  36726. if (!$this->definition->hasOption($name)) {
  36727. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36728. }
  36729. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  36730. }
  36731. public function setOption($name, $value)
  36732. {
  36733. if (!$this->definition->hasOption($name)) {
  36734. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36735. }
  36736. $this->options[$name] = $value;
  36737. }
  36738. public function hasOption($name)
  36739. {
  36740. return $this->definition->hasOption($name);
  36741. }
  36742. public function escapeToken($token)
  36743. {
  36744. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  36745. }
  36746. }
  36747. <?php
  36748. namespace Symfony\Component\Console\Input;
  36749. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36750. use Symfony\Component\Console\Exception\LogicException;
  36751. class InputArgument
  36752. {
  36753. const REQUIRED = 1;
  36754. const OPTIONAL = 2;
  36755. const IS_ARRAY = 4;
  36756. private $name;
  36757. private $mode;
  36758. private $default;
  36759. private $description;
  36760. public function __construct($name, $mode = null, $description = '', $default = null)
  36761. {
  36762. if (null === $mode) {
  36763. $mode = self::OPTIONAL;
  36764. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  36765. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  36766. }
  36767. $this->name = $name;
  36768. $this->mode = $mode;
  36769. $this->description = $description;
  36770. $this->setDefault($default);
  36771. }
  36772. public function getName()
  36773. {
  36774. return $this->name;
  36775. }
  36776. public function isRequired()
  36777. {
  36778. return self::REQUIRED === (self::REQUIRED & $this->mode);
  36779. }
  36780. public function isArray()
  36781. {
  36782. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  36783. }
  36784. public function setDefault($default = null)
  36785. {
  36786. if (self::REQUIRED === $this->mode && null !== $default) {
  36787. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  36788. }
  36789. if ($this->isArray()) {
  36790. if (null === $default) {
  36791. $default = array();
  36792. } elseif (!\is_array($default)) {
  36793. throw new LogicException('A default value for an array argument must be an array.');
  36794. }
  36795. }
  36796. $this->default = $default;
  36797. }
  36798. public function getDefault()
  36799. {
  36800. return $this->default;
  36801. }
  36802. public function getDescription()
  36803. {
  36804. return $this->description;
  36805. }
  36806. }
  36807. <?php
  36808. namespace Symfony\Component\Console\Input;
  36809. interface InputAwareInterface
  36810. {
  36811. public function setInput(InputInterface $input);
  36812. }
  36813. <?php
  36814. namespace Symfony\Component\Console\Input;
  36815. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36816. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36817. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36818. use Symfony\Component\Console\Exception\LogicException;
  36819. use Symfony\Component\Console\Output\BufferedOutput;
  36820. class InputDefinition
  36821. {
  36822. private $arguments;
  36823. private $requiredCount;
  36824. private $hasAnArrayArgument = false;
  36825. private $hasOptional;
  36826. private $options;
  36827. private $shortcuts;
  36828. public function __construct(array $definition = array())
  36829. {
  36830. $this->setDefinition($definition);
  36831. }
  36832. public function setDefinition(array $definition)
  36833. {
  36834. $arguments = array();
  36835. $options = array();
  36836. foreach ($definition as $item) {
  36837. if ($item instanceof InputOption) {
  36838. $options[] = $item;
  36839. } else {
  36840. $arguments[] = $item;
  36841. }
  36842. }
  36843. $this->setArguments($arguments);
  36844. $this->setOptions($options);
  36845. }
  36846. public function setArguments($arguments = array())
  36847. {
  36848. $this->arguments = array();
  36849. $this->requiredCount = 0;
  36850. $this->hasOptional = false;
  36851. $this->hasAnArrayArgument = false;
  36852. $this->addArguments($arguments);
  36853. }
  36854. public function addArguments($arguments = array())
  36855. {
  36856. if (null !== $arguments) {
  36857. foreach ($arguments as $argument) {
  36858. $this->addArgument($argument);
  36859. }
  36860. }
  36861. }
  36862. public function addArgument(InputArgument $argument)
  36863. {
  36864. if (isset($this->arguments[$argument->getName()])) {
  36865. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  36866. }
  36867. if ($this->hasAnArrayArgument) {
  36868. throw new LogicException('Cannot add an argument after an array argument.');
  36869. }
  36870. if ($argument->isRequired() && $this->hasOptional) {
  36871. throw new LogicException('Cannot add a required argument after an optional one.');
  36872. }
  36873. if ($argument->isArray()) {
  36874. $this->hasAnArrayArgument = true;
  36875. }
  36876. if ($argument->isRequired()) {
  36877. ++$this->requiredCount;
  36878. } else {
  36879. $this->hasOptional = true;
  36880. }
  36881. $this->arguments[$argument->getName()] = $argument;
  36882. }
  36883. public function getArgument($name)
  36884. {
  36885. if (!$this->hasArgument($name)) {
  36886. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36887. }
  36888. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36889. return $arguments[$name];
  36890. }
  36891. public function hasArgument($name)
  36892. {
  36893. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36894. return isset($arguments[$name]);
  36895. }
  36896. public function getArguments()
  36897. {
  36898. return $this->arguments;
  36899. }
  36900. public function getArgumentCount()
  36901. {
  36902. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  36903. }
  36904. public function getArgumentRequiredCount()
  36905. {
  36906. return $this->requiredCount;
  36907. }
  36908. public function getArgumentDefaults()
  36909. {
  36910. $values = array();
  36911. foreach ($this->arguments as $argument) {
  36912. $values[$argument->getName()] = $argument->getDefault();
  36913. }
  36914. return $values;
  36915. }
  36916. public function setOptions($options = array())
  36917. {
  36918. $this->options = array();
  36919. $this->shortcuts = array();
  36920. $this->addOptions($options);
  36921. }
  36922. public function addOptions($options = array())
  36923. {
  36924. foreach ($options as $option) {
  36925. $this->addOption($option);
  36926. }
  36927. }
  36928. public function addOption(InputOption $option)
  36929. {
  36930. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  36931. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  36932. }
  36933. if ($option->getShortcut()) {
  36934. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36935. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  36936. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  36937. }
  36938. }
  36939. }
  36940. $this->options[$option->getName()] = $option;
  36941. if ($option->getShortcut()) {
  36942. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36943. $this->shortcuts[$shortcut] = $option->getName();
  36944. }
  36945. }
  36946. }
  36947. public function getOption($name)
  36948. {
  36949. if (!$this->hasOption($name)) {
  36950. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  36951. }
  36952. return $this->options[$name];
  36953. }
  36954. public function hasOption($name)
  36955. {
  36956. return isset($this->options[$name]);
  36957. }
  36958. public function getOptions()
  36959. {
  36960. return $this->options;
  36961. }
  36962. public function hasShortcut($name)
  36963. {
  36964. return isset($this->shortcuts[$name]);
  36965. }
  36966. public function getOptionForShortcut($shortcut)
  36967. {
  36968. return $this->getOption($this->shortcutToName($shortcut));
  36969. }
  36970. public function getOptionDefaults()
  36971. {
  36972. $values = array();
  36973. foreach ($this->options as $option) {
  36974. $values[$option->getName()] = $option->getDefault();
  36975. }
  36976. return $values;
  36977. }
  36978. private function shortcutToName($shortcut)
  36979. {
  36980. if (!isset($this->shortcuts[$shortcut])) {
  36981. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  36982. }
  36983. return $this->shortcuts[$shortcut];
  36984. }
  36985. public function getSynopsis($short = false)
  36986. {
  36987. $elements = array();
  36988. if ($short && $this->getOptions()) {
  36989. $elements[] = '[options]';
  36990. } elseif (!$short) {
  36991. foreach ($this->getOptions() as $option) {
  36992. $value = '';
  36993. if ($option->acceptValue()) {
  36994. $value = sprintf(
  36995. ' %s%s%s',
  36996. $option->isValueOptional() ? '[' : '',
  36997. strtoupper($option->getName()),
  36998. $option->isValueOptional() ? ']' : ''
  36999. );
  37000. }
  37001. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  37002. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  37003. }
  37004. }
  37005. if (\count($elements) && $this->getArguments()) {
  37006. $elements[] = '[--]';
  37007. }
  37008. foreach ($this->getArguments() as $argument) {
  37009. $element = '<'.$argument->getName().'>';
  37010. if (!$argument->isRequired()) {
  37011. $element = '['.$element.']';
  37012. } elseif ($argument->isArray()) {
  37013. $element .= ' ('.$element.')';
  37014. }
  37015. if ($argument->isArray()) {
  37016. $element .= '...';
  37017. }
  37018. $elements[] = $element;
  37019. }
  37020. return implode(' ', $elements);
  37021. }
  37022. public function asText()
  37023. {
  37024. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37025. $descriptor = new TextDescriptor();
  37026. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  37027. $descriptor->describe($output, $this, array('raw_output' => true));
  37028. return $output->fetch();
  37029. }
  37030. public function asXml($asDom = false)
  37031. {
  37032. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37033. $descriptor = new XmlDescriptor();
  37034. if ($asDom) {
  37035. return $descriptor->getInputDefinitionDocument($this);
  37036. }
  37037. $output = new BufferedOutput();
  37038. $descriptor->describe($output, $this);
  37039. return $output->fetch();
  37040. }
  37041. }
  37042. <?php
  37043. namespace Symfony\Component\Console\Input;
  37044. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37045. use Symfony\Component\Console\Exception\RuntimeException;
  37046. interface InputInterface
  37047. {
  37048. public function getFirstArgument();
  37049. public function hasParameterOption($values);
  37050. public function getParameterOption($values, $default = false);
  37051. public function bind(InputDefinition $definition);
  37052. public function validate();
  37053. public function getArguments();
  37054. public function getArgument($name);
  37055. public function setArgument($name, $value);
  37056. public function hasArgument($name);
  37057. public function getOptions();
  37058. public function getOption($name);
  37059. public function setOption($name, $value);
  37060. public function hasOption($name);
  37061. public function isInteractive();
  37062. public function setInteractive($interactive);
  37063. }
  37064. <?php
  37065. namespace Symfony\Component\Console\Input;
  37066. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37067. use Symfony\Component\Console\Exception\LogicException;
  37068. class InputOption
  37069. {
  37070. const VALUE_NONE = 1;
  37071. const VALUE_REQUIRED = 2;
  37072. const VALUE_OPTIONAL = 4;
  37073. const VALUE_IS_ARRAY = 8;
  37074. private $name;
  37075. private $shortcut;
  37076. private $mode;
  37077. private $default;
  37078. private $description;
  37079. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  37080. {
  37081. if (0 === strpos($name, '--')) {
  37082. $name = substr($name, 2);
  37083. }
  37084. if (empty($name)) {
  37085. throw new InvalidArgumentException('An option name cannot be empty.');
  37086. }
  37087. if (empty($shortcut)) {
  37088. $shortcut = null;
  37089. }
  37090. if (null !== $shortcut) {
  37091. if (\is_array($shortcut)) {
  37092. $shortcut = implode('|', $shortcut);
  37093. }
  37094. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  37095. $shortcuts = array_filter($shortcuts);
  37096. $shortcut = implode('|', $shortcuts);
  37097. if (empty($shortcut)) {
  37098. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  37099. }
  37100. }
  37101. if (null === $mode) {
  37102. $mode = self::VALUE_NONE;
  37103. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  37104. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  37105. }
  37106. $this->name = $name;
  37107. $this->shortcut = $shortcut;
  37108. $this->mode = $mode;
  37109. $this->description = $description;
  37110. if ($this->isArray() && !$this->acceptValue()) {
  37111. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  37112. }
  37113. $this->setDefault($default);
  37114. }
  37115. public function getShortcut()
  37116. {
  37117. return $this->shortcut;
  37118. }
  37119. public function getName()
  37120. {
  37121. return $this->name;
  37122. }
  37123. public function acceptValue()
  37124. {
  37125. return $this->isValueRequired() || $this->isValueOptional();
  37126. }
  37127. public function isValueRequired()
  37128. {
  37129. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  37130. }
  37131. public function isValueOptional()
  37132. {
  37133. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  37134. }
  37135. public function isArray()
  37136. {
  37137. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  37138. }
  37139. public function setDefault($default = null)
  37140. {
  37141. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  37142. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  37143. }
  37144. if ($this->isArray()) {
  37145. if (null === $default) {
  37146. $default = array();
  37147. } elseif (!\is_array($default)) {
  37148. throw new LogicException('A default value for an array option must be an array.');
  37149. }
  37150. }
  37151. $this->default = $this->acceptValue() ? $default : false;
  37152. }
  37153. public function getDefault()
  37154. {
  37155. return $this->default;
  37156. }
  37157. public function getDescription()
  37158. {
  37159. return $this->description;
  37160. }
  37161. public function equals(self $option)
  37162. {
  37163. return $option->getName() === $this->getName()
  37164. && $option->getShortcut() === $this->getShortcut()
  37165. && $option->getDefault() === $this->getDefault()
  37166. && $option->isArray() === $this->isArray()
  37167. && $option->isValueRequired() === $this->isValueRequired()
  37168. && $option->isValueOptional() === $this->isValueOptional()
  37169. ;
  37170. }
  37171. }
  37172. <?php
  37173. namespace Symfony\Component\Console\Input;
  37174. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37175. class StringInput extends ArgvInput
  37176. {
  37177. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  37178. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  37179. public function __construct($input, InputDefinition $definition = null)
  37180. {
  37181. if ($definition) {
  37182. @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);
  37183. }
  37184. parent::__construct(array(), null);
  37185. $this->setTokens($this->tokenize($input));
  37186. if (null !== $definition) {
  37187. $this->bind($definition);
  37188. }
  37189. }
  37190. private function tokenize($input)
  37191. {
  37192. $tokens = array();
  37193. $length = \strlen($input);
  37194. $cursor = 0;
  37195. while ($cursor < $length) {
  37196. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  37197. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  37198. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  37199. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  37200. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  37201. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  37202. $tokens[] = stripcslashes($match[1]);
  37203. } else {
  37204. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  37205. }
  37206. $cursor += \strlen($match[0]);
  37207. }
  37208. return $tokens;
  37209. }
  37210. }
  37211. Copyright (c) 2004-2018 Fabien Potencier
  37212. Permission is hereby granted, free of charge, to any person obtaining a copy
  37213. of this software and associated documentation files (the "Software"), to deal
  37214. in the Software without restriction, including without limitation the rights
  37215. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37216. copies of the Software, and to permit persons to whom the Software is furnished
  37217. to do so, subject to the following conditions:
  37218. The above copyright notice and this permission notice shall be included in all
  37219. copies or substantial portions of the Software.
  37220. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37221. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37222. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37223. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37224. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37225. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37226. THE SOFTWARE.
  37227. <?php
  37228. namespace Symfony\Component\Console\Logger;
  37229. use Psr\Log\AbstractLogger;
  37230. use Psr\Log\InvalidArgumentException;
  37231. use Psr\Log\LogLevel;
  37232. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  37233. use Symfony\Component\Console\Output\OutputInterface;
  37234. class ConsoleLogger extends AbstractLogger
  37235. {
  37236. const INFO = 'info';
  37237. const ERROR = 'error';
  37238. private $output;
  37239. private $verbosityLevelMap = array(
  37240. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  37241. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  37242. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  37243. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  37244. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  37245. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  37246. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  37247. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  37248. );
  37249. private $formatLevelMap = array(
  37250. LogLevel::EMERGENCY => self::ERROR,
  37251. LogLevel::ALERT => self::ERROR,
  37252. LogLevel::CRITICAL => self::ERROR,
  37253. LogLevel::ERROR => self::ERROR,
  37254. LogLevel::WARNING => self::INFO,
  37255. LogLevel::NOTICE => self::INFO,
  37256. LogLevel::INFO => self::INFO,
  37257. LogLevel::DEBUG => self::INFO,
  37258. );
  37259. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  37260. {
  37261. $this->output = $output;
  37262. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  37263. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  37264. }
  37265. public function log($level, $message, array $context = array())
  37266. {
  37267. if (!isset($this->verbosityLevelMap[$level])) {
  37268. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  37269. }
  37270. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  37271. $output = $this->output->getErrorOutput();
  37272. } else {
  37273. $output = $this->output;
  37274. }
  37275. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  37276. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  37277. }
  37278. }
  37279. private function interpolate($message, array $context)
  37280. {
  37281. $replace = array();
  37282. foreach ($context as $key => $val) {
  37283. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  37284. $replace[sprintf('{%s}', $key)] = $val;
  37285. }
  37286. }
  37287. return strtr($message, $replace);
  37288. }
  37289. }
  37290. <?php
  37291. namespace Symfony\Component\Console\Output;
  37292. class BufferedOutput extends Output
  37293. {
  37294. private $buffer = '';
  37295. public function fetch()
  37296. {
  37297. $content = $this->buffer;
  37298. $this->buffer = '';
  37299. return $content;
  37300. }
  37301. protected function doWrite($message, $newline)
  37302. {
  37303. $this->buffer .= $message;
  37304. if ($newline) {
  37305. $this->buffer .= PHP_EOL;
  37306. }
  37307. }
  37308. }
  37309. <?php
  37310. namespace Symfony\Component\Console\Output;
  37311. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37312. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  37313. {
  37314. private $stderr;
  37315. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37316. {
  37317. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  37318. $actualDecorated = $this->isDecorated();
  37319. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  37320. if (null === $decorated) {
  37321. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  37322. }
  37323. }
  37324. public function setDecorated($decorated)
  37325. {
  37326. parent::setDecorated($decorated);
  37327. $this->stderr->setDecorated($decorated);
  37328. }
  37329. public function setFormatter(OutputFormatterInterface $formatter)
  37330. {
  37331. parent::setFormatter($formatter);
  37332. $this->stderr->setFormatter($formatter);
  37333. }
  37334. public function setVerbosity($level)
  37335. {
  37336. parent::setVerbosity($level);
  37337. $this->stderr->setVerbosity($level);
  37338. }
  37339. public function getErrorOutput()
  37340. {
  37341. return $this->stderr;
  37342. }
  37343. public function setErrorOutput(OutputInterface $error)
  37344. {
  37345. $this->stderr = $error;
  37346. }
  37347. protected function hasStdoutSupport()
  37348. {
  37349. return false === $this->isRunningOS400();
  37350. }
  37351. protected function hasStderrSupport()
  37352. {
  37353. return false === $this->isRunningOS400();
  37354. }
  37355. private function isRunningOS400()
  37356. {
  37357. $checks = array(
  37358. \function_exists('php_uname') ? php_uname('s') : '',
  37359. getenv('OSTYPE'),
  37360. PHP_OS,
  37361. );
  37362. return false !== stripos(implode(';', $checks), 'OS400');
  37363. }
  37364. private function openOutputStream()
  37365. {
  37366. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  37367. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  37368. }
  37369. private function openErrorStream()
  37370. {
  37371. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  37372. return fopen($errorStream, 'w');
  37373. }
  37374. }
  37375. <?php
  37376. namespace Symfony\Component\Console\Output;
  37377. interface ConsoleOutputInterface extends OutputInterface
  37378. {
  37379. public function getErrorOutput();
  37380. public function setErrorOutput(OutputInterface $error);
  37381. }
  37382. <?php
  37383. namespace Symfony\Component\Console\Output;
  37384. use Symfony\Component\Console\Formatter\OutputFormatter;
  37385. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37386. class NullOutput implements OutputInterface
  37387. {
  37388. public function setFormatter(OutputFormatterInterface $formatter)
  37389. {
  37390. }
  37391. public function getFormatter()
  37392. {
  37393. return new OutputFormatter();
  37394. }
  37395. public function setDecorated($decorated)
  37396. {
  37397. }
  37398. public function isDecorated()
  37399. {
  37400. return false;
  37401. }
  37402. public function setVerbosity($level)
  37403. {
  37404. }
  37405. public function getVerbosity()
  37406. {
  37407. return self::VERBOSITY_QUIET;
  37408. }
  37409. public function isQuiet()
  37410. {
  37411. return true;
  37412. }
  37413. public function isVerbose()
  37414. {
  37415. return false;
  37416. }
  37417. public function isVeryVerbose()
  37418. {
  37419. return false;
  37420. }
  37421. public function isDebug()
  37422. {
  37423. return false;
  37424. }
  37425. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37426. {
  37427. }
  37428. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37429. {
  37430. }
  37431. }
  37432. <?php
  37433. namespace Symfony\Component\Console\Output;
  37434. use Symfony\Component\Console\Formatter\OutputFormatter;
  37435. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37436. abstract class Output implements OutputInterface
  37437. {
  37438. private $verbosity;
  37439. private $formatter;
  37440. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  37441. {
  37442. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  37443. $this->formatter = $formatter ?: new OutputFormatter();
  37444. $this->formatter->setDecorated($decorated);
  37445. }
  37446. public function setFormatter(OutputFormatterInterface $formatter)
  37447. {
  37448. $this->formatter = $formatter;
  37449. }
  37450. public function getFormatter()
  37451. {
  37452. return $this->formatter;
  37453. }
  37454. public function setDecorated($decorated)
  37455. {
  37456. $this->formatter->setDecorated($decorated);
  37457. }
  37458. public function isDecorated()
  37459. {
  37460. return $this->formatter->isDecorated();
  37461. }
  37462. public function setVerbosity($level)
  37463. {
  37464. $this->verbosity = (int) $level;
  37465. }
  37466. public function getVerbosity()
  37467. {
  37468. return $this->verbosity;
  37469. }
  37470. public function isQuiet()
  37471. {
  37472. return self::VERBOSITY_QUIET === $this->verbosity;
  37473. }
  37474. public function isVerbose()
  37475. {
  37476. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  37477. }
  37478. public function isVeryVerbose()
  37479. {
  37480. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  37481. }
  37482. public function isDebug()
  37483. {
  37484. return self::VERBOSITY_DEBUG <= $this->verbosity;
  37485. }
  37486. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37487. {
  37488. $this->write($messages, true, $options);
  37489. }
  37490. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37491. {
  37492. $messages = (array) $messages;
  37493. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  37494. $type = $types & $options ?: self::OUTPUT_NORMAL;
  37495. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  37496. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  37497. if ($verbosity > $this->getVerbosity()) {
  37498. return;
  37499. }
  37500. foreach ($messages as $message) {
  37501. switch ($type) {
  37502. case OutputInterface::OUTPUT_NORMAL:
  37503. $message = $this->formatter->format($message);
  37504. break;
  37505. case OutputInterface::OUTPUT_RAW:
  37506. break;
  37507. case OutputInterface::OUTPUT_PLAIN:
  37508. $message = strip_tags($this->formatter->format($message));
  37509. break;
  37510. }
  37511. $this->doWrite($message, $newline);
  37512. }
  37513. }
  37514. abstract protected function doWrite($message, $newline);
  37515. }
  37516. <?php
  37517. namespace Symfony\Component\Console\Output;
  37518. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37519. interface OutputInterface
  37520. {
  37521. const VERBOSITY_QUIET = 16;
  37522. const VERBOSITY_NORMAL = 32;
  37523. const VERBOSITY_VERBOSE = 64;
  37524. const VERBOSITY_VERY_VERBOSE = 128;
  37525. const VERBOSITY_DEBUG = 256;
  37526. const OUTPUT_NORMAL = 1;
  37527. const OUTPUT_RAW = 2;
  37528. const OUTPUT_PLAIN = 4;
  37529. public function write($messages, $newline = false, $options = 0);
  37530. public function writeln($messages, $options = 0);
  37531. public function setVerbosity($level);
  37532. public function getVerbosity();
  37533. public function setDecorated($decorated);
  37534. public function isDecorated();
  37535. public function setFormatter(OutputFormatterInterface $formatter);
  37536. public function getFormatter();
  37537. }
  37538. <?php
  37539. namespace Symfony\Component\Console\Output;
  37540. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37541. use Symfony\Component\Console\Exception\RuntimeException;
  37542. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37543. class StreamOutput extends Output
  37544. {
  37545. private $stream;
  37546. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37547. {
  37548. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  37549. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  37550. }
  37551. $this->stream = $stream;
  37552. if (null === $decorated) {
  37553. $decorated = $this->hasColorSupport();
  37554. }
  37555. parent::__construct($verbosity, $decorated, $formatter);
  37556. }
  37557. public function getStream()
  37558. {
  37559. return $this->stream;
  37560. }
  37561. protected function doWrite($message, $newline)
  37562. {
  37563. if ($newline) {
  37564. $message .= PHP_EOL;
  37565. }
  37566. if (false === @fwrite($this->stream, $message)) {
  37567. throw new RuntimeException('Unable to write output.');
  37568. }
  37569. fflush($this->stream);
  37570. }
  37571. protected function hasColorSupport()
  37572. {
  37573. if ('Hyper' === getenv('TERM_PROGRAM')) {
  37574. return true;
  37575. }
  37576. if (\DIRECTORY_SEPARATOR === '\\') {
  37577. return (\function_exists('sapi_windows_vt100_support')
  37578. && @sapi_windows_vt100_support($this->stream))
  37579. || false !== getenv('ANSICON')
  37580. || 'ON' === getenv('ConEmuANSI')
  37581. || 'xterm' === getenv('TERM');
  37582. }
  37583. if (\function_exists('stream_isatty')) {
  37584. return @stream_isatty($this->stream);
  37585. }
  37586. if (\function_exists('posix_isatty')) {
  37587. return @posix_isatty($this->stream);
  37588. }
  37589. $stat = @fstat($this->stream);
  37590. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  37591. }
  37592. }
  37593. <?php
  37594. namespace Symfony\Component\Console\Question;
  37595. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37596. class ChoiceQuestion extends Question
  37597. {
  37598. private $choices;
  37599. private $multiselect = false;
  37600. private $prompt = ' > ';
  37601. private $errorMessage = 'Value "%s" is invalid';
  37602. public function __construct($question, array $choices, $default = null)
  37603. {
  37604. if (!$choices) {
  37605. throw new \LogicException('Choice question must have at least 1 choice available.');
  37606. }
  37607. parent::__construct($question, $default);
  37608. $this->choices = $choices;
  37609. $this->setValidator($this->getDefaultValidator());
  37610. $this->setAutocompleterValues($choices);
  37611. }
  37612. public function getChoices()
  37613. {
  37614. return $this->choices;
  37615. }
  37616. public function setMultiselect($multiselect)
  37617. {
  37618. $this->multiselect = $multiselect;
  37619. $this->setValidator($this->getDefaultValidator());
  37620. return $this;
  37621. }
  37622. public function isMultiselect()
  37623. {
  37624. return $this->multiselect;
  37625. }
  37626. public function getPrompt()
  37627. {
  37628. return $this->prompt;
  37629. }
  37630. public function setPrompt($prompt)
  37631. {
  37632. $this->prompt = $prompt;
  37633. return $this;
  37634. }
  37635. public function setErrorMessage($errorMessage)
  37636. {
  37637. $this->errorMessage = $errorMessage;
  37638. $this->setValidator($this->getDefaultValidator());
  37639. return $this;
  37640. }
  37641. private function getDefaultValidator()
  37642. {
  37643. $choices = $this->choices;
  37644. $errorMessage = $this->errorMessage;
  37645. $multiselect = $this->multiselect;
  37646. $isAssoc = $this->isAssoc($choices);
  37647. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  37648. $selectedChoices = str_replace(' ', '', $selected);
  37649. if ($multiselect) {
  37650. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  37651. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  37652. }
  37653. $selectedChoices = explode(',', $selectedChoices);
  37654. } else {
  37655. $selectedChoices = array($selected);
  37656. }
  37657. $multiselectChoices = array();
  37658. foreach ($selectedChoices as $value) {
  37659. $results = array();
  37660. foreach ($choices as $key => $choice) {
  37661. if ($choice === $value) {
  37662. $results[] = $key;
  37663. }
  37664. }
  37665. if (\count($results) > 1) {
  37666. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  37667. }
  37668. $result = array_search($value, $choices);
  37669. if (!$isAssoc) {
  37670. if (false !== $result) {
  37671. $result = $choices[$result];
  37672. } elseif (isset($choices[$value])) {
  37673. $result = $choices[$value];
  37674. }
  37675. } elseif (false === $result && isset($choices[$value])) {
  37676. $result = $value;
  37677. }
  37678. if (false === $result) {
  37679. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  37680. }
  37681. $multiselectChoices[] = (string) $result;
  37682. }
  37683. if ($multiselect) {
  37684. return $multiselectChoices;
  37685. }
  37686. return current($multiselectChoices);
  37687. };
  37688. }
  37689. }
  37690. <?php
  37691. namespace Symfony\Component\Console\Question;
  37692. class ConfirmationQuestion extends Question
  37693. {
  37694. private $trueAnswerRegex;
  37695. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  37696. {
  37697. parent::__construct($question, (bool) $default);
  37698. $this->trueAnswerRegex = $trueAnswerRegex;
  37699. $this->setNormalizer($this->getDefaultNormalizer());
  37700. }
  37701. private function getDefaultNormalizer()
  37702. {
  37703. $default = $this->getDefault();
  37704. $regex = $this->trueAnswerRegex;
  37705. return function ($answer) use ($default, $regex) {
  37706. if (\is_bool($answer)) {
  37707. return $answer;
  37708. }
  37709. $answerIsTrue = (bool) preg_match($regex, $answer);
  37710. if (false === $default) {
  37711. return $answer && $answerIsTrue;
  37712. }
  37713. return !$answer || $answerIsTrue;
  37714. };
  37715. }
  37716. }
  37717. <?php
  37718. namespace Symfony\Component\Console\Question;
  37719. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37720. use Symfony\Component\Console\Exception\LogicException;
  37721. class Question
  37722. {
  37723. private $question;
  37724. private $attempts;
  37725. private $hidden = false;
  37726. private $hiddenFallback = true;
  37727. private $autocompleterValues;
  37728. private $validator;
  37729. private $default;
  37730. private $normalizer;
  37731. public function __construct($question, $default = null)
  37732. {
  37733. $this->question = $question;
  37734. $this->default = $default;
  37735. }
  37736. public function getQuestion()
  37737. {
  37738. return $this->question;
  37739. }
  37740. public function getDefault()
  37741. {
  37742. return $this->default;
  37743. }
  37744. public function isHidden()
  37745. {
  37746. return $this->hidden;
  37747. }
  37748. public function setHidden($hidden)
  37749. {
  37750. if ($this->autocompleterValues) {
  37751. throw new LogicException('A hidden question cannot use the autocompleter.');
  37752. }
  37753. $this->hidden = (bool) $hidden;
  37754. return $this;
  37755. }
  37756. public function isHiddenFallback()
  37757. {
  37758. return $this->hiddenFallback;
  37759. }
  37760. public function setHiddenFallback($fallback)
  37761. {
  37762. $this->hiddenFallback = (bool) $fallback;
  37763. return $this;
  37764. }
  37765. public function getAutocompleterValues()
  37766. {
  37767. return $this->autocompleterValues;
  37768. }
  37769. public function setAutocompleterValues($values)
  37770. {
  37771. if (\is_array($values)) {
  37772. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  37773. }
  37774. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  37775. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  37776. }
  37777. if ($this->hidden) {
  37778. throw new LogicException('A hidden question cannot use the autocompleter.');
  37779. }
  37780. $this->autocompleterValues = $values;
  37781. return $this;
  37782. }
  37783. public function setValidator($validator)
  37784. {
  37785. $this->validator = $validator;
  37786. return $this;
  37787. }
  37788. public function getValidator()
  37789. {
  37790. return $this->validator;
  37791. }
  37792. public function setMaxAttempts($attempts)
  37793. {
  37794. if (null !== $attempts && $attempts < 1) {
  37795. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  37796. }
  37797. $this->attempts = $attempts;
  37798. return $this;
  37799. }
  37800. public function getMaxAttempts()
  37801. {
  37802. return $this->attempts;
  37803. }
  37804. public function setNormalizer($normalizer)
  37805. {
  37806. $this->normalizer = $normalizer;
  37807. return $this;
  37808. }
  37809. public function getNormalizer()
  37810. {
  37811. return $this->normalizer;
  37812. }
  37813. protected function isAssoc($array)
  37814. {
  37815. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  37816. }
  37817. }
  37818. <?php
  37819. namespace Symfony\Component\Console;
  37820. use Symfony\Component\Console\Exception\RuntimeException;
  37821. use Symfony\Component\Console\Input\StringInput;
  37822. use Symfony\Component\Console\Output\ConsoleOutput;
  37823. use Symfony\Component\Process\PhpExecutableFinder;
  37824. use Symfony\Component\Process\ProcessBuilder;
  37825. class Shell
  37826. {
  37827. private $application;
  37828. private $history;
  37829. private $output;
  37830. private $hasReadline;
  37831. private $processIsolation = false;
  37832. public function __construct(Application $application)
  37833. {
  37834. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37835. $this->hasReadline = \function_exists('readline');
  37836. $this->application = $application;
  37837. $this->history = getenv('HOME').'/.history_'.$application->getName();
  37838. $this->output = new ConsoleOutput();
  37839. }
  37840. public function run()
  37841. {
  37842. $this->application->setAutoExit(false);
  37843. $this->application->setCatchExceptions(true);
  37844. if ($this->hasReadline) {
  37845. readline_read_history($this->history);
  37846. readline_completion_function(array($this, 'autocompleter'));
  37847. }
  37848. $this->output->writeln($this->getHeader());
  37849. $php = null;
  37850. if ($this->processIsolation) {
  37851. $finder = new PhpExecutableFinder();
  37852. $php = $finder->find();
  37853. $this->output->writeln(<<<'EOF'
  37854. <info>Running with process isolation, you should consider this:</info>
  37855. * each command is executed as separate process,
  37856. * commands don't support interactivity, all params must be passed explicitly,
  37857. * commands output is not colorized.
  37858. EOF
  37859. );
  37860. }
  37861. while (true) {
  37862. $command = $this->readline();
  37863. if (false === $command) {
  37864. $this->output->writeln("\n");
  37865. break;
  37866. }
  37867. if ($this->hasReadline) {
  37868. readline_add_history($command);
  37869. readline_write_history($this->history);
  37870. }
  37871. if ($this->processIsolation) {
  37872. $pb = new ProcessBuilder();
  37873. $process = $pb
  37874. ->add($php)
  37875. ->add($_SERVER['argv'][0])
  37876. ->add($command)
  37877. ->inheritEnvironmentVariables(true)
  37878. ->getProcess()
  37879. ;
  37880. $output = $this->output;
  37881. $process->run(function ($type, $data) use ($output) {
  37882. $output->writeln($data);
  37883. });
  37884. $ret = $process->getExitCode();
  37885. } else {
  37886. $ret = $this->application->run(new StringInput($command), $this->output);
  37887. }
  37888. if (0 !== $ret) {
  37889. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  37890. }
  37891. }
  37892. }
  37893. protected function getHeader()
  37894. {
  37895. return <<<EOF
  37896. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  37897. At the prompt, type <comment>help</comment> for some help,
  37898. or <comment>list</comment> to get a list of available commands.
  37899. To exit the shell, type <comment>^D</comment>.
  37900. EOF;
  37901. }
  37902. protected function getPrompt()
  37903. {
  37904. return $this->output->getFormatter()->format($this->application->getName().' > ');
  37905. }
  37906. protected function getOutput()
  37907. {
  37908. return $this->output;
  37909. }
  37910. protected function getApplication()
  37911. {
  37912. return $this->application;
  37913. }
  37914. private function autocompleter($text)
  37915. {
  37916. $info = readline_info();
  37917. $text = substr($info['line_buffer'], 0, $info['end']);
  37918. if ($info['point'] !== $info['end']) {
  37919. return true;
  37920. }
  37921. if (false === strpos($text, ' ') || !$text) {
  37922. return array_keys($this->application->all());
  37923. }
  37924. try {
  37925. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  37926. } catch (\Exception $e) {
  37927. return true;
  37928. }
  37929. $list = array('--help');
  37930. foreach ($command->getDefinition()->getOptions() as $option) {
  37931. $list[] = '--'.$option->getName();
  37932. }
  37933. return $list;
  37934. }
  37935. private function readline()
  37936. {
  37937. if ($this->hasReadline) {
  37938. $line = readline($this->getPrompt());
  37939. } else {
  37940. $this->output->write($this->getPrompt());
  37941. $line = fgets(STDIN, 1024);
  37942. $line = (false === $line || '' === $line) ? false : rtrim($line);
  37943. }
  37944. return $line;
  37945. }
  37946. public function getProcessIsolation()
  37947. {
  37948. return $this->processIsolation;
  37949. }
  37950. public function setProcessIsolation($processIsolation)
  37951. {
  37952. $this->processIsolation = (bool) $processIsolation;
  37953. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  37954. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  37955. }
  37956. }
  37957. }
  37958. <?php
  37959. namespace Symfony\Component\Console\Style;
  37960. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37961. use Symfony\Component\Console\Helper\ProgressBar;
  37962. use Symfony\Component\Console\Output\OutputInterface;
  37963. abstract class OutputStyle implements OutputInterface, StyleInterface
  37964. {
  37965. private $output;
  37966. public function __construct(OutputInterface $output)
  37967. {
  37968. $this->output = $output;
  37969. }
  37970. public function newLine($count = 1)
  37971. {
  37972. $this->output->write(str_repeat(PHP_EOL, $count));
  37973. }
  37974. public function createProgressBar($max = 0)
  37975. {
  37976. return new ProgressBar($this->output, $max);
  37977. }
  37978. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37979. {
  37980. $this->output->write($messages, $newline, $type);
  37981. }
  37982. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37983. {
  37984. $this->output->writeln($messages, $type);
  37985. }
  37986. public function setVerbosity($level)
  37987. {
  37988. $this->output->setVerbosity($level);
  37989. }
  37990. public function getVerbosity()
  37991. {
  37992. return $this->output->getVerbosity();
  37993. }
  37994. public function setDecorated($decorated)
  37995. {
  37996. $this->output->setDecorated($decorated);
  37997. }
  37998. public function isDecorated()
  37999. {
  38000. return $this->output->isDecorated();
  38001. }
  38002. public function setFormatter(OutputFormatterInterface $formatter)
  38003. {
  38004. $this->output->setFormatter($formatter);
  38005. }
  38006. public function getFormatter()
  38007. {
  38008. return $this->output->getFormatter();
  38009. }
  38010. }
  38011. <?php
  38012. namespace Symfony\Component\Console\Style;
  38013. interface StyleInterface
  38014. {
  38015. public function title($message);
  38016. public function section($message);
  38017. public function listing(array $elements);
  38018. public function text($message);
  38019. public function success($message);
  38020. public function error($message);
  38021. public function warning($message);
  38022. public function note($message);
  38023. public function caution($message);
  38024. public function table(array $headers, array $rows);
  38025. public function ask($question, $default = null, $validator = null);
  38026. public function askHidden($question, $validator = null);
  38027. public function confirm($question, $default = true);
  38028. public function choice($question, array $choices, $default = null);
  38029. public function newLine($count = 1);
  38030. public function progressStart($max = 0);
  38031. public function progressAdvance($step = 1);
  38032. public function progressFinish();
  38033. }
  38034. <?php
  38035. namespace Symfony\Component\Console\Style;
  38036. use Symfony\Component\Console\Application;
  38037. use Symfony\Component\Console\Exception\RuntimeException;
  38038. use Symfony\Component\Console\Formatter\OutputFormatter;
  38039. use Symfony\Component\Console\Helper\Helper;
  38040. use Symfony\Component\Console\Helper\ProgressBar;
  38041. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  38042. use Symfony\Component\Console\Helper\Table;
  38043. use Symfony\Component\Console\Input\InputInterface;
  38044. use Symfony\Component\Console\Output\BufferedOutput;
  38045. use Symfony\Component\Console\Output\OutputInterface;
  38046. use Symfony\Component\Console\Question\ChoiceQuestion;
  38047. use Symfony\Component\Console\Question\ConfirmationQuestion;
  38048. use Symfony\Component\Console\Question\Question;
  38049. class SymfonyStyle extends OutputStyle
  38050. {
  38051. const MAX_LINE_LENGTH = 120;
  38052. private $input;
  38053. private $questionHelper;
  38054. private $progressBar;
  38055. private $lineLength;
  38056. private $bufferedOutput;
  38057. public function __construct(InputInterface $input, OutputInterface $output)
  38058. {
  38059. $this->input = $input;
  38060. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  38061. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  38062. parent::__construct($output);
  38063. }
  38064. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  38065. {
  38066. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  38067. $this->autoPrependBlock();
  38068. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  38069. $this->newLine();
  38070. }
  38071. public function title($message)
  38072. {
  38073. $this->autoPrependBlock();
  38074. $this->writeln(array(
  38075. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38076. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38077. ));
  38078. $this->newLine();
  38079. }
  38080. public function section($message)
  38081. {
  38082. $this->autoPrependBlock();
  38083. $this->writeln(array(
  38084. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38085. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38086. ));
  38087. $this->newLine();
  38088. }
  38089. public function listing(array $elements)
  38090. {
  38091. $this->autoPrependText();
  38092. $elements = array_map(function ($element) {
  38093. return sprintf(' * %s', $element);
  38094. }, $elements);
  38095. $this->writeln($elements);
  38096. $this->newLine();
  38097. }
  38098. public function text($message)
  38099. {
  38100. $this->autoPrependText();
  38101. $messages = \is_array($message) ? array_values($message) : array($message);
  38102. foreach ($messages as $message) {
  38103. $this->writeln(sprintf(' %s', $message));
  38104. }
  38105. }
  38106. public function comment($message)
  38107. {
  38108. $messages = \is_array($message) ? array_values($message) : array($message);
  38109. $this->autoPrependBlock();
  38110. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  38111. $this->newLine();
  38112. }
  38113. public function success($message)
  38114. {
  38115. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  38116. }
  38117. public function error($message)
  38118. {
  38119. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  38120. }
  38121. public function warning($message)
  38122. {
  38123. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  38124. }
  38125. public function note($message)
  38126. {
  38127. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  38128. }
  38129. public function caution($message)
  38130. {
  38131. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  38132. }
  38133. public function table(array $headers, array $rows)
  38134. {
  38135. $style = clone Table::getStyleDefinition('symfony-style-guide');
  38136. $style->setCellHeaderFormat('<info>%s</info>');
  38137. $table = new Table($this);
  38138. $table->setHeaders($headers);
  38139. $table->setRows($rows);
  38140. $table->setStyle($style);
  38141. $table->render();
  38142. $this->newLine();
  38143. }
  38144. public function ask($question, $default = null, $validator = null)
  38145. {
  38146. $question = new Question($question, $default);
  38147. $question->setValidator($validator);
  38148. return $this->askQuestion($question);
  38149. }
  38150. public function askHidden($question, $validator = null)
  38151. {
  38152. $question = new Question($question);
  38153. $question->setHidden(true);
  38154. $question->setValidator($validator);
  38155. return $this->askQuestion($question);
  38156. }
  38157. public function confirm($question, $default = true)
  38158. {
  38159. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  38160. }
  38161. public function choice($question, array $choices, $default = null)
  38162. {
  38163. if (null !== $default) {
  38164. $values = array_flip($choices);
  38165. $default = $values[$default];
  38166. }
  38167. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  38168. }
  38169. public function progressStart($max = 0)
  38170. {
  38171. $this->progressBar = $this->createProgressBar($max);
  38172. $this->progressBar->start();
  38173. }
  38174. public function progressAdvance($step = 1)
  38175. {
  38176. $this->getProgressBar()->advance($step);
  38177. }
  38178. public function progressFinish()
  38179. {
  38180. $this->getProgressBar()->finish();
  38181. $this->newLine(2);
  38182. $this->progressBar = null;
  38183. }
  38184. public function createProgressBar($max = 0)
  38185. {
  38186. $progressBar = parent::createProgressBar($max);
  38187. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  38188. $progressBar->setEmptyBarCharacter('â–‘');
  38189. $progressBar->setProgressCharacter('');
  38190. $progressBar->setBarCharacter('â–“');
  38191. }
  38192. return $progressBar;
  38193. }
  38194. public function askQuestion(Question $question)
  38195. {
  38196. if ($this->input->isInteractive()) {
  38197. $this->autoPrependBlock();
  38198. }
  38199. if (!$this->questionHelper) {
  38200. $this->questionHelper = new SymfonyQuestionHelper();
  38201. }
  38202. $answer = $this->questionHelper->ask($this->input, $this, $question);
  38203. if ($this->input->isInteractive()) {
  38204. $this->newLine();
  38205. $this->bufferedOutput->write("\n");
  38206. }
  38207. return $answer;
  38208. }
  38209. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  38210. {
  38211. parent::writeln($messages, $type);
  38212. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  38213. }
  38214. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  38215. {
  38216. parent::write($messages, $newline, $type);
  38217. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  38218. }
  38219. public function newLine($count = 1)
  38220. {
  38221. parent::newLine($count);
  38222. $this->bufferedOutput->write(str_repeat("\n", $count));
  38223. }
  38224. private function getProgressBar()
  38225. {
  38226. if (!$this->progressBar) {
  38227. throw new RuntimeException('The ProgressBar is not started.');
  38228. }
  38229. return $this->progressBar;
  38230. }
  38231. private function getTerminalWidth()
  38232. {
  38233. $application = new Application();
  38234. $dimensions = $application->getTerminalDimensions();
  38235. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  38236. }
  38237. private function autoPrependBlock()
  38238. {
  38239. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  38240. if (!isset($chars[0])) {
  38241. return $this->newLine();
  38242. }
  38243. $this->newLine(2 - substr_count($chars, "\n"));
  38244. }
  38245. private function autoPrependText()
  38246. {
  38247. $fetched = $this->bufferedOutput->fetch();
  38248. if ("\n" !== substr($fetched, -1)) {
  38249. $this->newLine();
  38250. }
  38251. }
  38252. private function reduceBuffer($messages)
  38253. {
  38254. return array_map(function ($value) {
  38255. return substr($value, -4);
  38256. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  38257. }
  38258. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  38259. {
  38260. $indentLength = 0;
  38261. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  38262. $lines = array();
  38263. if (null !== $type) {
  38264. $type = sprintf('[%s] ', $type);
  38265. $indentLength = \strlen($type);
  38266. $lineIndentation = str_repeat(' ', $indentLength);
  38267. }
  38268. foreach ($messages as $key => $message) {
  38269. if ($escape) {
  38270. $message = OutputFormatter::escape($message);
  38271. }
  38272. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  38273. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  38274. $lines[] = '';
  38275. }
  38276. }
  38277. $firstLineIndex = 0;
  38278. if ($padding && $this->isDecorated()) {
  38279. $firstLineIndex = 1;
  38280. array_unshift($lines, '');
  38281. $lines[] = '';
  38282. }
  38283. foreach ($lines as $i => &$line) {
  38284. if (null !== $type) {
  38285. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  38286. }
  38287. $line = $prefix.$line;
  38288. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  38289. if ($style) {
  38290. $line = sprintf('<%s>%s</>', $style, $line);
  38291. }
  38292. }
  38293. return $lines;
  38294. }
  38295. }
  38296. <?php
  38297. namespace Symfony\Component\Console\Tester;
  38298. use Symfony\Component\Console\Application;
  38299. use Symfony\Component\Console\Input\ArrayInput;
  38300. use Symfony\Component\Console\Input\InputInterface;
  38301. use Symfony\Component\Console\Output\OutputInterface;
  38302. use Symfony\Component\Console\Output\StreamOutput;
  38303. class ApplicationTester
  38304. {
  38305. private $application;
  38306. private $input;
  38307. private $output;
  38308. private $statusCode;
  38309. public function __construct(Application $application)
  38310. {
  38311. $this->application = $application;
  38312. }
  38313. public function run(array $input, $options = array())
  38314. {
  38315. $this->input = new ArrayInput($input);
  38316. if (isset($options['interactive'])) {
  38317. $this->input->setInteractive($options['interactive']);
  38318. }
  38319. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38320. if (isset($options['decorated'])) {
  38321. $this->output->setDecorated($options['decorated']);
  38322. }
  38323. if (isset($options['verbosity'])) {
  38324. $this->output->setVerbosity($options['verbosity']);
  38325. }
  38326. return $this->statusCode = $this->application->run($this->input, $this->output);
  38327. }
  38328. public function getDisplay($normalize = false)
  38329. {
  38330. rewind($this->output->getStream());
  38331. $display = stream_get_contents($this->output->getStream());
  38332. if ($normalize) {
  38333. $display = str_replace(PHP_EOL, "\n", $display);
  38334. }
  38335. return $display;
  38336. }
  38337. public function getInput()
  38338. {
  38339. return $this->input;
  38340. }
  38341. public function getOutput()
  38342. {
  38343. return $this->output;
  38344. }
  38345. public function getStatusCode()
  38346. {
  38347. return $this->statusCode;
  38348. }
  38349. }
  38350. <?php
  38351. namespace Symfony\Component\Console\Tester;
  38352. use Symfony\Component\Console\Command\Command;
  38353. use Symfony\Component\Console\Input\ArrayInput;
  38354. use Symfony\Component\Console\Input\InputInterface;
  38355. use Symfony\Component\Console\Output\OutputInterface;
  38356. use Symfony\Component\Console\Output\StreamOutput;
  38357. class CommandTester
  38358. {
  38359. private $command;
  38360. private $input;
  38361. private $output;
  38362. private $statusCode;
  38363. public function __construct(Command $command)
  38364. {
  38365. $this->command = $command;
  38366. }
  38367. public function execute(array $input, array $options = array())
  38368. {
  38369. if (!isset($input['command'])
  38370. && (null !== $application = $this->command->getApplication())
  38371. && $application->getDefinition()->hasArgument('command')
  38372. ) {
  38373. $input = array_merge(array('command' => $this->command->getName()), $input);
  38374. }
  38375. $this->input = new ArrayInput($input);
  38376. if (isset($options['interactive'])) {
  38377. $this->input->setInteractive($options['interactive']);
  38378. }
  38379. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38380. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  38381. if (isset($options['verbosity'])) {
  38382. $this->output->setVerbosity($options['verbosity']);
  38383. }
  38384. return $this->statusCode = $this->command->run($this->input, $this->output);
  38385. }
  38386. public function getDisplay($normalize = false)
  38387. {
  38388. rewind($this->output->getStream());
  38389. $display = stream_get_contents($this->output->getStream());
  38390. if ($normalize) {
  38391. $display = str_replace(PHP_EOL, "\n", $display);
  38392. }
  38393. return $display;
  38394. }
  38395. public function getInput()
  38396. {
  38397. return $this->input;
  38398. }
  38399. public function getOutput()
  38400. {
  38401. return $this->output;
  38402. }
  38403. public function getStatusCode()
  38404. {
  38405. return $this->statusCode;
  38406. }
  38407. }
  38408. <?php
  38409. namespace Symfony\Component\Debug;
  38410. use Psr\Log\AbstractLogger;
  38411. class BufferingLogger extends AbstractLogger
  38412. {
  38413. private $logs = array();
  38414. public function log($level, $message, array $context = array())
  38415. {
  38416. $this->logs[] = array($level, $message, $context);
  38417. }
  38418. public function cleanLogs()
  38419. {
  38420. $logs = $this->logs;
  38421. $this->logs = array();
  38422. return $logs;
  38423. }
  38424. }
  38425. <?php
  38426. namespace Symfony\Component\Debug;
  38427. class Debug
  38428. {
  38429. private static $enabled = false;
  38430. public static function enable($errorReportingLevel = null, $displayErrors = true)
  38431. {
  38432. if (static::$enabled) {
  38433. return;
  38434. }
  38435. static::$enabled = true;
  38436. if (null !== $errorReportingLevel) {
  38437. error_reporting($errorReportingLevel);
  38438. } else {
  38439. error_reporting(-1);
  38440. }
  38441. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  38442. ini_set('display_errors', 0);
  38443. ExceptionHandler::register();
  38444. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  38445. ini_set('display_errors', 1);
  38446. }
  38447. if ($displayErrors) {
  38448. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  38449. } else {
  38450. ErrorHandler::register()->throwAt(0, true);
  38451. }
  38452. DebugClassLoader::enable();
  38453. }
  38454. }
  38455. <?php
  38456. namespace Symfony\Component\Debug;
  38457. class DebugClassLoader
  38458. {
  38459. private $classLoader;
  38460. private $isFinder;
  38461. private $loaded = array();
  38462. private $wasFinder;
  38463. private static $caseCheck;
  38464. private static $deprecated = array();
  38465. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  38466. private static $darwinCache = array('/' => array('/', array()));
  38467. public function __construct($classLoader)
  38468. {
  38469. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  38470. if ($this->wasFinder) {
  38471. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  38472. $this->classLoader = array($classLoader, 'loadClass');
  38473. $this->isFinder = true;
  38474. } else {
  38475. $this->classLoader = $classLoader;
  38476. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  38477. }
  38478. if (!isset(self::$caseCheck)) {
  38479. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  38480. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  38481. $dir = substr($file, 0, 1 + $i);
  38482. $file = substr($file, 1 + $i);
  38483. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  38484. $test = realpath($dir.$test);
  38485. if (false === $test || false === $i) {
  38486. self::$caseCheck = 0;
  38487. } elseif (substr($test, -\strlen($file)) === $file) {
  38488. self::$caseCheck = 1;
  38489. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  38490. self::$caseCheck = 2;
  38491. } else {
  38492. self::$caseCheck = 0;
  38493. }
  38494. }
  38495. }
  38496. public function getClassLoader()
  38497. {
  38498. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  38499. }
  38500. public static function enable()
  38501. {
  38502. class_exists('Symfony\Component\Debug\ErrorHandler');
  38503. class_exists('Psr\Log\LogLevel');
  38504. if (!\is_array($functions = spl_autoload_functions())) {
  38505. return;
  38506. }
  38507. foreach ($functions as $function) {
  38508. spl_autoload_unregister($function);
  38509. }
  38510. foreach ($functions as $function) {
  38511. if (!\is_array($function) || !$function[0] instanceof self) {
  38512. $function = array(new static($function), 'loadClass');
  38513. }
  38514. spl_autoload_register($function);
  38515. }
  38516. }
  38517. public static function disable()
  38518. {
  38519. if (!\is_array($functions = spl_autoload_functions())) {
  38520. return;
  38521. }
  38522. foreach ($functions as $function) {
  38523. spl_autoload_unregister($function);
  38524. }
  38525. foreach ($functions as $function) {
  38526. if (\is_array($function) && $function[0] instanceof self) {
  38527. $function = $function[0]->getClassLoader();
  38528. }
  38529. spl_autoload_register($function);
  38530. }
  38531. }
  38532. public function findFile($class)
  38533. {
  38534. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38535. if ($this->wasFinder) {
  38536. return $this->classLoader[0]->findFile($class);
  38537. }
  38538. }
  38539. public function loadClass($class)
  38540. {
  38541. ErrorHandler::stackErrors();
  38542. try {
  38543. if ($this->isFinder && !isset($this->loaded[$class])) {
  38544. $this->loaded[$class] = true;
  38545. if ($file = $this->classLoader[0]->findFile($class)) {
  38546. require $file;
  38547. }
  38548. } else {
  38549. \call_user_func($this->classLoader, $class);
  38550. $file = false;
  38551. }
  38552. } catch (\Exception $e) {
  38553. ErrorHandler::unstackErrors();
  38554. throw $e;
  38555. } catch (\Throwable $e) {
  38556. ErrorHandler::unstackErrors();
  38557. throw $e;
  38558. }
  38559. ErrorHandler::unstackErrors();
  38560. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  38561. if ($class && '\\' === $class[0]) {
  38562. $class = substr($class, 1);
  38563. }
  38564. if ($exists) {
  38565. $refl = new \ReflectionClass($class);
  38566. $name = $refl->getName();
  38567. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  38568. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  38569. }
  38570. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  38571. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  38572. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  38573. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  38574. } else {
  38575. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  38576. $len = 0;
  38577. $ns = '';
  38578. } else {
  38579. $ns = substr($name, 0, $len);
  38580. }
  38581. $parent = get_parent_class($class);
  38582. if (!$parent || strncmp($ns, $parent, $len)) {
  38583. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  38584. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  38585. }
  38586. $parentInterfaces = array();
  38587. $deprecatedInterfaces = array();
  38588. if ($parent) {
  38589. foreach (class_implements($parent) as $interface) {
  38590. $parentInterfaces[$interface] = 1;
  38591. }
  38592. }
  38593. foreach ($refl->getInterfaceNames() as $interface) {
  38594. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  38595. $deprecatedInterfaces[] = $interface;
  38596. }
  38597. foreach (class_implements($interface) as $interface) {
  38598. $parentInterfaces[$interface] = 1;
  38599. }
  38600. }
  38601. foreach ($deprecatedInterfaces as $interface) {
  38602. if (!isset($parentInterfaces[$interface])) {
  38603. @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);
  38604. }
  38605. }
  38606. }
  38607. }
  38608. }
  38609. if ($file) {
  38610. if (!$exists) {
  38611. if (false !== strpos($class, '/')) {
  38612. 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));
  38613. }
  38614. 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));
  38615. }
  38616. if (self::$caseCheck) {
  38617. $real = explode('\\', $class.strrchr($file, '.'));
  38618. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  38619. $i = \count($tail) - 1;
  38620. $j = \count($real) - 1;
  38621. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  38622. --$i;
  38623. --$j;
  38624. }
  38625. array_splice($tail, 0, $i + 1);
  38626. }
  38627. if (self::$caseCheck && $tail) {
  38628. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  38629. $tailLen = \strlen($tail);
  38630. $real = $refl->getFileName();
  38631. if (2 === self::$caseCheck) {
  38632. $i = 1 + strrpos($real, '/');
  38633. $file = substr($real, $i);
  38634. $real = substr($real, 0, $i);
  38635. if (isset(self::$darwinCache[$real])) {
  38636. $kDir = $real;
  38637. } else {
  38638. $kDir = strtolower($real);
  38639. if (isset(self::$darwinCache[$kDir])) {
  38640. $real = self::$darwinCache[$kDir][0];
  38641. } else {
  38642. $dir = getcwd();
  38643. chdir($real);
  38644. $real = getcwd().'/';
  38645. chdir($dir);
  38646. $dir = $real;
  38647. $k = $kDir;
  38648. $i = \strlen($dir) - 1;
  38649. while (!isset(self::$darwinCache[$k])) {
  38650. self::$darwinCache[$k] = array($dir, array());
  38651. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  38652. while ('/' !== $dir[--$i]) {
  38653. }
  38654. $k = substr($k, 0, ++$i);
  38655. $dir = substr($dir, 0, $i--);
  38656. }
  38657. }
  38658. }
  38659. $dirFiles = self::$darwinCache[$kDir][1];
  38660. if (isset($dirFiles[$file])) {
  38661. $kFile = $file;
  38662. } else {
  38663. $kFile = strtolower($file);
  38664. if (!isset($dirFiles[$kFile])) {
  38665. foreach (scandir($real, 2) as $f) {
  38666. if ('.' !== $f[0]) {
  38667. $dirFiles[$f] = $f;
  38668. if ($f === $file) {
  38669. $kFile = $k = $file;
  38670. } elseif ($f !== $k = strtolower($f)) {
  38671. $dirFiles[$k] = $f;
  38672. }
  38673. }
  38674. }
  38675. self::$darwinCache[$kDir][1] = $dirFiles;
  38676. }
  38677. }
  38678. $real .= $dirFiles[$kFile];
  38679. }
  38680. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  38681. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  38682. ) {
  38683. 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)));
  38684. }
  38685. }
  38686. return true;
  38687. }
  38688. }
  38689. }
  38690. <?php
  38691. namespace Symfony\Component\Debug;
  38692. use Psr\Log\LoggerInterface;
  38693. use Psr\Log\LogLevel;
  38694. use Symfony\Component\Debug\Exception\ContextErrorException;
  38695. use Symfony\Component\Debug\Exception\FatalErrorException;
  38696. use Symfony\Component\Debug\Exception\FatalThrowableError;
  38697. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38698. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  38699. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  38700. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  38701. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  38702. class ErrorHandler
  38703. {
  38704. const TYPE_DEPRECATION = -100;
  38705. private $levels = array(
  38706. E_DEPRECATED => 'Deprecated',
  38707. E_USER_DEPRECATED => 'User Deprecated',
  38708. E_NOTICE => 'Notice',
  38709. E_USER_NOTICE => 'User Notice',
  38710. E_STRICT => 'Runtime Notice',
  38711. E_WARNING => 'Warning',
  38712. E_USER_WARNING => 'User Warning',
  38713. E_COMPILE_WARNING => 'Compile Warning',
  38714. E_CORE_WARNING => 'Core Warning',
  38715. E_USER_ERROR => 'User Error',
  38716. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  38717. E_COMPILE_ERROR => 'Compile Error',
  38718. E_PARSE => 'Parse Error',
  38719. E_ERROR => 'Error',
  38720. E_CORE_ERROR => 'Core Error',
  38721. );
  38722. private $loggers = array(
  38723. E_DEPRECATED => array(null, LogLevel::INFO),
  38724. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  38725. E_NOTICE => array(null, LogLevel::WARNING),
  38726. E_USER_NOTICE => array(null, LogLevel::WARNING),
  38727. E_STRICT => array(null, LogLevel::WARNING),
  38728. E_WARNING => array(null, LogLevel::WARNING),
  38729. E_USER_WARNING => array(null, LogLevel::WARNING),
  38730. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  38731. E_CORE_WARNING => array(null, LogLevel::WARNING),
  38732. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  38733. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  38734. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  38735. E_PARSE => array(null, LogLevel::CRITICAL),
  38736. E_ERROR => array(null, LogLevel::CRITICAL),
  38737. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  38738. );
  38739. private $thrownErrors = 0x1FFF;
  38740. private $scopedErrors = 0x1FFF;
  38741. private $tracedErrors = 0x77FB;
  38742. private $screamedErrors = 0x55;
  38743. private $loggedErrors = 0;
  38744. private $loggedTraces = array();
  38745. private $isRecursive = 0;
  38746. private $isRoot = false;
  38747. private $exceptionHandler;
  38748. private $bootstrappingLogger;
  38749. private static $reservedMemory;
  38750. private static $stackedErrors = array();
  38751. private static $stackedErrorLevels = array();
  38752. private static $toStringException = null;
  38753. private static $exitCode = 0;
  38754. private $displayErrors = 0x1FFF;
  38755. public static function register($handler = null, $replace = true)
  38756. {
  38757. if (null === self::$reservedMemory) {
  38758. self::$reservedMemory = str_repeat('x', 10240);
  38759. register_shutdown_function(__CLASS__.'::handleFatalError');
  38760. }
  38761. $levels = -1;
  38762. if ($handlerIsNew = !$handler instanceof self) {
  38763. if (null !== $handler) {
  38764. $levels = $replace ? $handler : 0;
  38765. $replace = true;
  38766. }
  38767. $handler = new static();
  38768. }
  38769. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  38770. restore_error_handler();
  38771. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  38772. $handler->isRoot = true;
  38773. }
  38774. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  38775. $handler = $prev[0];
  38776. $replace = false;
  38777. }
  38778. if (!$replace && $prev) {
  38779. restore_error_handler();
  38780. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  38781. } else {
  38782. $handlerIsRegistered = true;
  38783. }
  38784. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  38785. restore_exception_handler();
  38786. if (!$handlerIsRegistered) {
  38787. $handler = $prev[0];
  38788. } elseif ($handler !== $prev[0] && $replace) {
  38789. set_exception_handler(array($handler, 'handleException'));
  38790. $p = $prev[0]->setExceptionHandler(null);
  38791. $handler->setExceptionHandler($p);
  38792. $prev[0]->setExceptionHandler($p);
  38793. }
  38794. } else {
  38795. $handler->setExceptionHandler($prev);
  38796. }
  38797. $handler->throwAt($levels & $handler->thrownErrors, true);
  38798. return $handler;
  38799. }
  38800. public function __construct(BufferingLogger $bootstrappingLogger = null)
  38801. {
  38802. if ($bootstrappingLogger) {
  38803. $this->bootstrappingLogger = $bootstrappingLogger;
  38804. $this->setDefaultLogger($bootstrappingLogger);
  38805. }
  38806. }
  38807. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  38808. {
  38809. $loggers = array();
  38810. if (\is_array($levels)) {
  38811. foreach ($levels as $type => $logLevel) {
  38812. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  38813. $loggers[$type] = array($logger, $logLevel);
  38814. }
  38815. }
  38816. } else {
  38817. if (null === $levels) {
  38818. $levels = E_ALL | E_STRICT;
  38819. }
  38820. foreach ($this->loggers as $type => $log) {
  38821. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  38822. $log[0] = $logger;
  38823. $loggers[$type] = $log;
  38824. }
  38825. }
  38826. }
  38827. $this->setLoggers($loggers);
  38828. }
  38829. public function setLoggers(array $loggers)
  38830. {
  38831. $prevLogged = $this->loggedErrors;
  38832. $prev = $this->loggers;
  38833. $flush = array();
  38834. foreach ($loggers as $type => $log) {
  38835. if (!isset($prev[$type])) {
  38836. throw new \InvalidArgumentException('Unknown error type: '.$type);
  38837. }
  38838. if (!\is_array($log)) {
  38839. $log = array($log);
  38840. } elseif (!array_key_exists(0, $log)) {
  38841. throw new \InvalidArgumentException('No logger provided');
  38842. }
  38843. if (null === $log[0]) {
  38844. $this->loggedErrors &= ~$type;
  38845. } elseif ($log[0] instanceof LoggerInterface) {
  38846. $this->loggedErrors |= $type;
  38847. } else {
  38848. throw new \InvalidArgumentException('Invalid logger provided');
  38849. }
  38850. $this->loggers[$type] = $log + $prev[$type];
  38851. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  38852. $flush[$type] = $type;
  38853. }
  38854. }
  38855. $this->reRegister($prevLogged | $this->thrownErrors);
  38856. if ($flush) {
  38857. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  38858. $type = $log[2]['type'];
  38859. if (!isset($flush[$type])) {
  38860. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  38861. } elseif ($this->loggers[$type][0]) {
  38862. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  38863. }
  38864. }
  38865. }
  38866. return $prev;
  38867. }
  38868. public function setExceptionHandler($handler)
  38869. {
  38870. if (null !== $handler && !\is_callable($handler)) {
  38871. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38872. }
  38873. $prev = $this->exceptionHandler;
  38874. $this->exceptionHandler = $handler;
  38875. return $prev;
  38876. }
  38877. public function throwAt($levels, $replace = false)
  38878. {
  38879. $prev = $this->thrownErrors;
  38880. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  38881. if (!$replace) {
  38882. $this->thrownErrors |= $prev;
  38883. }
  38884. $this->reRegister($prev | $this->loggedErrors);
  38885. $this->displayErrors = $this->thrownErrors;
  38886. return $prev;
  38887. }
  38888. public function scopeAt($levels, $replace = false)
  38889. {
  38890. $prev = $this->scopedErrors;
  38891. $this->scopedErrors = (int) $levels;
  38892. if (!$replace) {
  38893. $this->scopedErrors |= $prev;
  38894. }
  38895. return $prev;
  38896. }
  38897. public function traceAt($levels, $replace = false)
  38898. {
  38899. $prev = $this->tracedErrors;
  38900. $this->tracedErrors = (int) $levels;
  38901. if (!$replace) {
  38902. $this->tracedErrors |= $prev;
  38903. }
  38904. return $prev;
  38905. }
  38906. public function screamAt($levels, $replace = false)
  38907. {
  38908. $prev = $this->screamedErrors;
  38909. $this->screamedErrors = (int) $levels;
  38910. if (!$replace) {
  38911. $this->screamedErrors |= $prev;
  38912. }
  38913. return $prev;
  38914. }
  38915. private function reRegister($prev)
  38916. {
  38917. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  38918. $handler = set_error_handler('var_dump');
  38919. $handler = \is_array($handler) ? $handler[0] : null;
  38920. restore_error_handler();
  38921. if ($handler === $this) {
  38922. restore_error_handler();
  38923. if ($this->isRoot) {
  38924. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  38925. } else {
  38926. set_error_handler(array($this, 'handleError'));
  38927. }
  38928. }
  38929. }
  38930. }
  38931. public function handleError($type, $message, $file, $line)
  38932. {
  38933. $level = error_reporting();
  38934. $silenced = 0 === ($level & $type);
  38935. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  38936. $log = $this->loggedErrors & $type;
  38937. $throw = $this->thrownErrors & $type & $level;
  38938. $type &= $level | $this->screamedErrors;
  38939. if (!$type || (!$log && !$throw)) {
  38940. return !$silenced && $type && $log;
  38941. }
  38942. $scope = $this->scopedErrors & $type;
  38943. if (4 < $numArgs = \func_num_args()) {
  38944. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  38945. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  38946. } else {
  38947. $context = array();
  38948. $backtrace = null;
  38949. }
  38950. if (isset($context['GLOBALS']) && $scope) {
  38951. $e = $context;
  38952. unset($e['GLOBALS'], $context);
  38953. $context = $e;
  38954. }
  38955. if (null !== $backtrace && $type & E_ERROR) {
  38956. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  38957. return true;
  38958. }
  38959. if ($throw) {
  38960. if (null !== self::$toStringException) {
  38961. $throw = self::$toStringException;
  38962. self::$toStringException = null;
  38963. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  38964. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  38965. } else {
  38966. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  38967. }
  38968. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  38969. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  38970. }
  38971. if (E_USER_ERROR & $type) {
  38972. $backtrace = $backtrace ?: $throw->getTrace();
  38973. for ($i = 1; isset($backtrace[$i]); ++$i) {
  38974. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  38975. && '__toString' === $backtrace[$i]['function']
  38976. && '->' === $backtrace[$i]['type']
  38977. && !isset($backtrace[$i - 1]['class'])
  38978. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  38979. ) {
  38980. foreach ($context as $e) {
  38981. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  38982. if (1 === $i) {
  38983. $throw = $e;
  38984. break;
  38985. }
  38986. self::$toStringException = $e;
  38987. return true;
  38988. }
  38989. }
  38990. if (1 < $i) {
  38991. $this->handleException($throw);
  38992. return false;
  38993. }
  38994. }
  38995. }
  38996. }
  38997. throw $throw;
  38998. }
  38999. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  39000. $trace = true;
  39001. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  39002. $trace = false;
  39003. } else {
  39004. $this->loggedTraces[$e] = 1;
  39005. }
  39006. $e = compact('type', 'file', 'line', 'level');
  39007. if ($type & $level) {
  39008. if ($scope) {
  39009. $e['scope_vars'] = $context;
  39010. if ($trace) {
  39011. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  39012. }
  39013. } elseif ($trace) {
  39014. if (null === $backtrace) {
  39015. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  39016. } else {
  39017. foreach ($backtrace as &$frame) {
  39018. unset($frame['args'], $frame);
  39019. }
  39020. $e['stack'] = $backtrace;
  39021. }
  39022. }
  39023. }
  39024. if ($this->isRecursive) {
  39025. $log = 0;
  39026. } elseif (self::$stackedErrorLevels) {
  39027. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39028. } else {
  39029. try {
  39030. $this->isRecursive = true;
  39031. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39032. $this->isRecursive = false;
  39033. } catch (\Exception $e) {
  39034. $this->isRecursive = false;
  39035. throw $e;
  39036. } catch (\Throwable $e) {
  39037. $this->isRecursive = false;
  39038. throw $e;
  39039. }
  39040. }
  39041. return !$silenced && $type && $log;
  39042. }
  39043. public function handleException($exception, array $error = null)
  39044. {
  39045. if (null === $error) {
  39046. self::$exitCode = 255;
  39047. }
  39048. if (!$exception instanceof \Exception) {
  39049. $exception = new FatalThrowableError($exception);
  39050. }
  39051. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  39052. $handlerException = null;
  39053. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  39054. $e = array(
  39055. 'type' => $type,
  39056. 'file' => $exception->getFile(),
  39057. 'line' => $exception->getLine(),
  39058. 'level' => error_reporting(),
  39059. 'stack' => $exception->getTrace(),
  39060. );
  39061. if ($exception instanceof FatalErrorException) {
  39062. if ($exception instanceof FatalThrowableError) {
  39063. $error = array(
  39064. 'type' => $type,
  39065. 'message' => $message = $exception->getMessage(),
  39066. 'file' => $e['file'],
  39067. 'line' => $e['line'],
  39068. );
  39069. } else {
  39070. $message = 'Fatal '.$exception->getMessage();
  39071. }
  39072. } elseif ($exception instanceof \ErrorException) {
  39073. $message = 'Uncaught '.$exception->getMessage();
  39074. if ($exception instanceof ContextErrorException) {
  39075. $e['context'] = $exception->getContext();
  39076. }
  39077. } else {
  39078. $message = 'Uncaught Exception: '.$exception->getMessage();
  39079. }
  39080. }
  39081. if ($this->loggedErrors & $type) {
  39082. try {
  39083. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  39084. } catch (\Exception $handlerException) {
  39085. } catch (\Throwable $handlerException) {
  39086. }
  39087. }
  39088. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  39089. foreach ($this->getFatalErrorHandlers() as $handler) {
  39090. if ($e = $handler->handleError($error, $exception)) {
  39091. $exception = $e;
  39092. break;
  39093. }
  39094. }
  39095. }
  39096. $exceptionHandler = $this->exceptionHandler;
  39097. $this->exceptionHandler = null;
  39098. try {
  39099. if (null !== $exceptionHandler) {
  39100. return \call_user_func($exceptionHandler, $exception);
  39101. }
  39102. $handlerException = $handlerException ?: $exception;
  39103. } catch (\Exception $handlerException) {
  39104. } catch (\Throwable $handlerException) {
  39105. }
  39106. if ($exception === $handlerException) {
  39107. self::$reservedMemory = null;
  39108. throw $exception;
  39109. }
  39110. $this->handleException($handlerException);
  39111. }
  39112. public static function handleFatalError(array $error = null)
  39113. {
  39114. if (null === self::$reservedMemory) {
  39115. return;
  39116. }
  39117. $handler = self::$reservedMemory = null;
  39118. $handlers = array();
  39119. $previousHandler = null;
  39120. $sameHandlerLimit = 10;
  39121. while (!\is_array($handler) || !$handler[0] instanceof self) {
  39122. $handler = set_exception_handler('var_dump');
  39123. restore_exception_handler();
  39124. if (!$handler) {
  39125. break;
  39126. }
  39127. restore_exception_handler();
  39128. if ($handler !== $previousHandler) {
  39129. array_unshift($handlers, $handler);
  39130. $previousHandler = $handler;
  39131. } elseif (0 === --$sameHandlerLimit) {
  39132. $handler = null;
  39133. break;
  39134. }
  39135. }
  39136. foreach ($handlers as $h) {
  39137. set_exception_handler($h);
  39138. }
  39139. if (!$handler) {
  39140. return;
  39141. }
  39142. if ($handler !== $h) {
  39143. $handler[0]->setExceptionHandler($h);
  39144. }
  39145. $handler = $handler[0];
  39146. $handlers = array();
  39147. if ($exit = null === $error) {
  39148. $error = error_get_last();
  39149. }
  39150. try {
  39151. while (self::$stackedErrorLevels) {
  39152. static::unstackErrors();
  39153. }
  39154. } catch (\Exception $exception) {
  39155. } catch (\Throwable $exception) {
  39156. }
  39157. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  39158. $handler->throwAt(0, true);
  39159. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  39160. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  39161. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  39162. } else {
  39163. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  39164. }
  39165. }
  39166. try {
  39167. if (isset($exception)) {
  39168. self::$exitCode = 255;
  39169. $handler->handleException($exception, $error);
  39170. }
  39171. } catch (FatalErrorException $e) {
  39172. }
  39173. if ($exit && self::$exitCode) {
  39174. $exitCode = self::$exitCode;
  39175. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  39176. }
  39177. }
  39178. public static function stackErrors()
  39179. {
  39180. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39181. }
  39182. public static function unstackErrors()
  39183. {
  39184. $level = array_pop(self::$stackedErrorLevels);
  39185. if (null !== $level) {
  39186. $e = error_reporting($level);
  39187. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  39188. error_reporting($e);
  39189. }
  39190. }
  39191. if (empty(self::$stackedErrorLevels)) {
  39192. $errors = self::$stackedErrors;
  39193. self::$stackedErrors = array();
  39194. foreach ($errors as $e) {
  39195. $e[0]->log($e[1], $e[2], $e[3]);
  39196. }
  39197. }
  39198. }
  39199. protected function getFatalErrorHandlers()
  39200. {
  39201. return array(
  39202. new UndefinedFunctionFatalErrorHandler(),
  39203. new UndefinedMethodFatalErrorHandler(),
  39204. new ClassNotFoundFatalErrorHandler(),
  39205. );
  39206. }
  39207. public function setLevel($level)
  39208. {
  39209. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  39210. $level = null === $level ? error_reporting() : $level;
  39211. $this->throwAt($level, true);
  39212. }
  39213. public function setDisplayErrors($displayErrors)
  39214. {
  39215. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  39216. if ($displayErrors) {
  39217. $this->throwAt($this->displayErrors, true);
  39218. } else {
  39219. $displayErrors = $this->displayErrors;
  39220. $this->throwAt(0, true);
  39221. $this->displayErrors = $displayErrors;
  39222. }
  39223. }
  39224. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  39225. {
  39226. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  39227. $handler = set_error_handler('var_dump');
  39228. $handler = \is_array($handler) ? $handler[0] : null;
  39229. restore_error_handler();
  39230. if (!$handler instanceof self) {
  39231. return;
  39232. }
  39233. if ('deprecation' === $channel) {
  39234. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  39235. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  39236. } elseif ('scream' === $channel) {
  39237. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  39238. $handler->screamAt(E_ALL | E_STRICT);
  39239. } elseif ('emergency' === $channel) {
  39240. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  39241. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39242. }
  39243. }
  39244. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  39245. {
  39246. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  39247. return $this->handleError($level, $message, $file, $line, (array) $context);
  39248. }
  39249. public function handleFatal()
  39250. {
  39251. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  39252. static::handleFatalError();
  39253. }
  39254. }
  39255. class ErrorHandlerCanary
  39256. {
  39257. private static $displayErrors = null;
  39258. public function __construct()
  39259. {
  39260. if (null === self::$displayErrors) {
  39261. self::$displayErrors = ini_set('display_errors', 1);
  39262. }
  39263. }
  39264. public function __destruct()
  39265. {
  39266. if (null !== self::$displayErrors) {
  39267. ini_set('display_errors', self::$displayErrors);
  39268. self::$displayErrors = null;
  39269. }
  39270. }
  39271. }
  39272. <?php
  39273. namespace Symfony\Component\Debug\Exception;
  39274. class ClassNotFoundException extends FatalErrorException
  39275. {
  39276. public function __construct($message, \ErrorException $previous)
  39277. {
  39278. parent::__construct(
  39279. $message,
  39280. $previous->getCode(),
  39281. $previous->getSeverity(),
  39282. $previous->getFile(),
  39283. $previous->getLine(),
  39284. null,
  39285. true,
  39286. null,
  39287. $previous->getPrevious()
  39288. );
  39289. $this->setTrace($previous->getTrace());
  39290. }
  39291. }
  39292. <?php
  39293. namespace Symfony\Component\Debug\Exception;
  39294. class ContextErrorException extends \ErrorException
  39295. {
  39296. private $context = array();
  39297. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  39298. {
  39299. parent::__construct($message, $code, $severity, $filename, $lineno);
  39300. $this->context = $context;
  39301. }
  39302. public function getContext()
  39303. {
  39304. return $this->context;
  39305. }
  39306. }
  39307. <?php
  39308. namespace Symfony\Component\Debug\Exception;
  39309. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39310. class DummyException extends \ErrorException
  39311. {
  39312. }
  39313. <?php
  39314. namespace Symfony\Component\HttpKernel\Exception;
  39315. class FatalErrorException extends \ErrorException
  39316. {
  39317. }
  39318. namespace Symfony\Component\Debug\Exception;
  39319. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  39320. class FatalErrorException extends LegacyFatalErrorException
  39321. {
  39322. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  39323. {
  39324. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  39325. if (null !== $trace) {
  39326. if (!$traceArgs) {
  39327. foreach ($trace as &$frame) {
  39328. unset($frame['args'], $frame['this'], $frame);
  39329. }
  39330. }
  39331. $this->setTrace($trace);
  39332. } elseif (null !== $traceOffset) {
  39333. if (\function_exists('xdebug_get_function_stack')) {
  39334. $trace = xdebug_get_function_stack();
  39335. if (0 < $traceOffset) {
  39336. array_splice($trace, -$traceOffset);
  39337. }
  39338. foreach ($trace as &$frame) {
  39339. if (!isset($frame['type'])) {
  39340. if (isset($frame['class'])) {
  39341. $frame['type'] = '::';
  39342. }
  39343. } elseif ('dynamic' === $frame['type']) {
  39344. $frame['type'] = '->';
  39345. } elseif ('static' === $frame['type']) {
  39346. $frame['type'] = '::';
  39347. }
  39348. if (!$traceArgs) {
  39349. unset($frame['params'], $frame['args']);
  39350. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  39351. $frame['args'] = $frame['params'];
  39352. unset($frame['params']);
  39353. }
  39354. }
  39355. unset($frame);
  39356. $trace = array_reverse($trace);
  39357. } elseif (\function_exists('symfony_debug_backtrace')) {
  39358. $trace = symfony_debug_backtrace();
  39359. if (0 < $traceOffset) {
  39360. array_splice($trace, 0, $traceOffset);
  39361. }
  39362. } else {
  39363. $trace = array();
  39364. }
  39365. $this->setTrace($trace);
  39366. }
  39367. }
  39368. protected function setTrace($trace)
  39369. {
  39370. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  39371. $traceReflector->setAccessible(true);
  39372. $traceReflector->setValue($this, $trace);
  39373. }
  39374. }
  39375. <?php
  39376. namespace Symfony\Component\Debug\Exception;
  39377. class FatalThrowableError extends FatalErrorException
  39378. {
  39379. public function __construct(\Throwable $e)
  39380. {
  39381. if ($e instanceof \ParseError) {
  39382. $message = 'Parse error: '.$e->getMessage();
  39383. $severity = E_PARSE;
  39384. } elseif ($e instanceof \TypeError) {
  39385. $message = 'Type error: '.$e->getMessage();
  39386. $severity = E_RECOVERABLE_ERROR;
  39387. } else {
  39388. $message = $e->getMessage();
  39389. $severity = E_ERROR;
  39390. }
  39391. \ErrorException::__construct(
  39392. $message,
  39393. $e->getCode(),
  39394. $severity,
  39395. $e->getFile(),
  39396. $e->getLine(),
  39397. $e->getPrevious()
  39398. );
  39399. $this->setTrace($e->getTrace());
  39400. }
  39401. }
  39402. <?php
  39403. namespace Symfony\Component\HttpKernel\Exception;
  39404. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  39405. class FlattenException
  39406. {
  39407. private $handler;
  39408. public static function __callStatic($method, $args)
  39409. {
  39410. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  39411. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  39412. }
  39413. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  39414. }
  39415. public function __call($method, $args)
  39416. {
  39417. if (!isset($this->handler)) {
  39418. $this->handler = new DebugFlattenException();
  39419. }
  39420. if (!method_exists($this->handler, $method)) {
  39421. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  39422. }
  39423. return \call_user_func_array(array($this->handler, $method), $args);
  39424. }
  39425. }
  39426. namespace Symfony\Component\Debug\Exception;
  39427. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  39428. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  39429. class FlattenException extends LegacyFlattenException
  39430. {
  39431. private $message;
  39432. private $code;
  39433. private $previous;
  39434. private $trace;
  39435. private $class;
  39436. private $statusCode;
  39437. private $headers;
  39438. private $file;
  39439. private $line;
  39440. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  39441. {
  39442. $e = new static();
  39443. $e->setMessage($exception->getMessage());
  39444. $e->setCode($exception->getCode());
  39445. if ($exception instanceof HttpExceptionInterface) {
  39446. $statusCode = $exception->getStatusCode();
  39447. $headers = array_merge($headers, $exception->getHeaders());
  39448. }
  39449. if (null === $statusCode) {
  39450. $statusCode = 500;
  39451. }
  39452. $e->setStatusCode($statusCode);
  39453. $e->setHeaders($headers);
  39454. $e->setTraceFromException($exception);
  39455. $e->setClass(\get_class($exception));
  39456. $e->setFile($exception->getFile());
  39457. $e->setLine($exception->getLine());
  39458. $previous = $exception->getPrevious();
  39459. if ($previous instanceof \Exception) {
  39460. $e->setPrevious(static::create($previous));
  39461. } elseif ($previous instanceof \Throwable) {
  39462. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  39463. }
  39464. return $e;
  39465. }
  39466. public function toArray()
  39467. {
  39468. $exceptions = array();
  39469. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  39470. $exceptions[] = array(
  39471. 'message' => $exception->getMessage(),
  39472. 'class' => $exception->getClass(),
  39473. 'trace' => $exception->getTrace(),
  39474. );
  39475. }
  39476. return $exceptions;
  39477. }
  39478. public function getStatusCode()
  39479. {
  39480. return $this->statusCode;
  39481. }
  39482. public function setStatusCode($code)
  39483. {
  39484. $this->statusCode = $code;
  39485. }
  39486. public function getHeaders()
  39487. {
  39488. return $this->headers;
  39489. }
  39490. public function setHeaders(array $headers)
  39491. {
  39492. $this->headers = $headers;
  39493. }
  39494. public function getClass()
  39495. {
  39496. return $this->class;
  39497. }
  39498. public function setClass($class)
  39499. {
  39500. $this->class = $class;
  39501. }
  39502. public function getFile()
  39503. {
  39504. return $this->file;
  39505. }
  39506. public function setFile($file)
  39507. {
  39508. $this->file = $file;
  39509. }
  39510. public function getLine()
  39511. {
  39512. return $this->line;
  39513. }
  39514. public function setLine($line)
  39515. {
  39516. $this->line = $line;
  39517. }
  39518. public function getMessage()
  39519. {
  39520. return $this->message;
  39521. }
  39522. public function setMessage($message)
  39523. {
  39524. $this->message = $message;
  39525. }
  39526. public function getCode()
  39527. {
  39528. return $this->code;
  39529. }
  39530. public function setCode($code)
  39531. {
  39532. $this->code = $code;
  39533. }
  39534. public function getPrevious()
  39535. {
  39536. return $this->previous;
  39537. }
  39538. public function setPrevious(FlattenException $previous)
  39539. {
  39540. $this->previous = $previous;
  39541. }
  39542. public function getAllPrevious()
  39543. {
  39544. $exceptions = array();
  39545. $e = $this;
  39546. while ($e = $e->getPrevious()) {
  39547. $exceptions[] = $e;
  39548. }
  39549. return $exceptions;
  39550. }
  39551. public function getTrace()
  39552. {
  39553. return $this->trace;
  39554. }
  39555. public function setTraceFromException(\Exception $exception)
  39556. {
  39557. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  39558. }
  39559. public function setTrace($trace, $file, $line)
  39560. {
  39561. $this->trace = array();
  39562. $this->trace[] = array(
  39563. 'namespace' => '',
  39564. 'short_class' => '',
  39565. 'class' => '',
  39566. 'type' => '',
  39567. 'function' => '',
  39568. 'file' => $file,
  39569. 'line' => $line,
  39570. 'args' => array(),
  39571. );
  39572. foreach ($trace as $entry) {
  39573. $class = '';
  39574. $namespace = '';
  39575. if (isset($entry['class'])) {
  39576. $parts = explode('\\', $entry['class']);
  39577. $class = array_pop($parts);
  39578. $namespace = implode('\\', $parts);
  39579. }
  39580. $this->trace[] = array(
  39581. 'namespace' => $namespace,
  39582. 'short_class' => $class,
  39583. 'class' => isset($entry['class']) ? $entry['class'] : '',
  39584. 'type' => isset($entry['type']) ? $entry['type'] : '',
  39585. 'function' => isset($entry['function']) ? $entry['function'] : null,
  39586. 'file' => isset($entry['file']) ? $entry['file'] : null,
  39587. 'line' => isset($entry['line']) ? $entry['line'] : null,
  39588. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  39589. );
  39590. }
  39591. }
  39592. private function flattenArgs($args, $level = 0, &$count = 0)
  39593. {
  39594. $result = array();
  39595. foreach ($args as $key => $value) {
  39596. if (++$count > 1e4) {
  39597. return array('array', '*SKIPPED over 10000 entries*');
  39598. }
  39599. if ($value instanceof \__PHP_Incomplete_Class) {
  39600. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  39601. } elseif (\is_object($value)) {
  39602. $result[$key] = array('object', \get_class($value));
  39603. } elseif (\is_array($value)) {
  39604. if ($level > 10) {
  39605. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  39606. } else {
  39607. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  39608. }
  39609. } elseif (null === $value) {
  39610. $result[$key] = array('null', null);
  39611. } elseif (\is_bool($value)) {
  39612. $result[$key] = array('boolean', $value);
  39613. } elseif (\is_resource($value)) {
  39614. $result[$key] = array('resource', get_resource_type($value));
  39615. } else {
  39616. $result[$key] = array('string', (string) $value);
  39617. }
  39618. }
  39619. return $result;
  39620. }
  39621. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  39622. {
  39623. $array = new \ArrayObject($value);
  39624. return $array['__PHP_Incomplete_Class_Name'];
  39625. }
  39626. }
  39627. <?php
  39628. namespace Symfony\Component\Debug\Exception;
  39629. class OutOfMemoryException extends FatalErrorException
  39630. {
  39631. }
  39632. <?php
  39633. namespace Symfony\Component\Debug\Exception;
  39634. class UndefinedFunctionException extends FatalErrorException
  39635. {
  39636. public function __construct($message, \ErrorException $previous)
  39637. {
  39638. parent::__construct(
  39639. $message,
  39640. $previous->getCode(),
  39641. $previous->getSeverity(),
  39642. $previous->getFile(),
  39643. $previous->getLine(),
  39644. null,
  39645. true,
  39646. null,
  39647. $previous->getPrevious()
  39648. );
  39649. $this->setTrace($previous->getTrace());
  39650. }
  39651. }
  39652. <?php
  39653. namespace Symfony\Component\Debug\Exception;
  39654. class UndefinedMethodException extends FatalErrorException
  39655. {
  39656. public function __construct($message, \ErrorException $previous)
  39657. {
  39658. parent::__construct(
  39659. $message,
  39660. $previous->getCode(),
  39661. $previous->getSeverity(),
  39662. $previous->getFile(),
  39663. $previous->getLine(),
  39664. null,
  39665. true,
  39666. null,
  39667. $previous->getPrevious()
  39668. );
  39669. $this->setTrace($previous->getTrace());
  39670. }
  39671. }
  39672. <?php
  39673. namespace Symfony\Component\Debug;
  39674. use Symfony\Component\Debug\Exception\FlattenException;
  39675. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  39676. use Symfony\Component\HttpFoundation\Response;
  39677. class ExceptionHandler
  39678. {
  39679. private $debug;
  39680. private $charset;
  39681. private $handler;
  39682. private $caughtBuffer;
  39683. private $caughtLength;
  39684. private $fileLinkFormat;
  39685. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  39686. {
  39687. if (false !== strpos($charset, '%')) {
  39688. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  39689. $pivot = $fileLinkFormat;
  39690. $fileLinkFormat = $charset;
  39691. $charset = $pivot;
  39692. }
  39693. $this->debug = $debug;
  39694. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  39695. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  39696. }
  39697. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  39698. {
  39699. $handler = new static($debug, $charset, $fileLinkFormat);
  39700. $prev = set_exception_handler(array($handler, 'handle'));
  39701. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  39702. restore_exception_handler();
  39703. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  39704. }
  39705. return $handler;
  39706. }
  39707. public function setHandler($handler)
  39708. {
  39709. if (null !== $handler && !\is_callable($handler)) {
  39710. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39711. }
  39712. $old = $this->handler;
  39713. $this->handler = $handler;
  39714. return $old;
  39715. }
  39716. public function setFileLinkFormat($format)
  39717. {
  39718. $old = $this->fileLinkFormat;
  39719. $this->fileLinkFormat = $format;
  39720. return $old;
  39721. }
  39722. public function handle(\Exception $exception)
  39723. {
  39724. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  39725. $this->failSafeHandle($exception);
  39726. return;
  39727. }
  39728. $caughtLength = $this->caughtLength = 0;
  39729. ob_start(array($this, 'catchOutput'));
  39730. $this->failSafeHandle($exception);
  39731. while (null === $this->caughtBuffer && ob_end_flush()) {
  39732. }
  39733. if (isset($this->caughtBuffer[0])) {
  39734. ob_start(array($this, 'cleanOutput'));
  39735. echo $this->caughtBuffer;
  39736. $caughtLength = ob_get_length();
  39737. }
  39738. $this->caughtBuffer = null;
  39739. try {
  39740. \call_user_func($this->handler, $exception);
  39741. $this->caughtLength = $caughtLength;
  39742. } catch (\Exception $e) {
  39743. if (!$caughtLength) {
  39744. throw $exception;
  39745. }
  39746. }
  39747. }
  39748. private function failSafeHandle(\Exception $exception)
  39749. {
  39750. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  39751. && __CLASS__ !== \get_class($this)
  39752. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  39753. && __CLASS__ !== $reflector->class
  39754. ) {
  39755. $response = $this->createResponse($exception);
  39756. $response->sendHeaders();
  39757. $response->sendContent();
  39758. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  39759. return;
  39760. }
  39761. $this->sendPhpResponse($exception);
  39762. }
  39763. public function sendPhpResponse($exception)
  39764. {
  39765. if (!$exception instanceof FlattenException) {
  39766. $exception = FlattenException::create($exception);
  39767. }
  39768. if (!headers_sent()) {
  39769. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  39770. foreach ($exception->getHeaders() as $name => $value) {
  39771. header($name.': '.$value, false);
  39772. }
  39773. header('Content-Type: text/html; charset='.$this->charset);
  39774. }
  39775. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39776. }
  39777. public function createResponse($exception)
  39778. {
  39779. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39780. if (!$exception instanceof FlattenException) {
  39781. $exception = FlattenException::create($exception);
  39782. }
  39783. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  39784. }
  39785. public function getHtml($exception)
  39786. {
  39787. if (!$exception instanceof FlattenException) {
  39788. $exception = FlattenException::create($exception);
  39789. }
  39790. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39791. }
  39792. public function getContent(FlattenException $exception)
  39793. {
  39794. switch ($exception->getStatusCode()) {
  39795. case 404:
  39796. $title = 'Sorry, the page you are looking for could not be found.';
  39797. break;
  39798. default:
  39799. $title = 'Whoops, looks like something went wrong.';
  39800. }
  39801. $content = '';
  39802. if ($this->debug) {
  39803. try {
  39804. $count = \count($exception->getAllPrevious());
  39805. $total = $count + 1;
  39806. foreach ($exception->toArray() as $position => $e) {
  39807. $ind = $count - $position + 1;
  39808. $class = $this->formatClass($e['class']);
  39809. $message = nl2br($this->escapeHtml($e['message']));
  39810. $content .= sprintf(<<<'EOF'
  39811. <h2 class="block_exception clear_fix">
  39812. <span class="exception_counter">%d/%d</span>
  39813. <span class="exception_title">%s%s:</span>
  39814. <span class="exception_message">%s</span>
  39815. </h2>
  39816. <div class="block">
  39817. <ol class="traces list_exception">
  39818. EOF
  39819. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  39820. foreach ($e['trace'] as $trace) {
  39821. $content .= ' <li>';
  39822. if ($trace['function']) {
  39823. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  39824. }
  39825. if (isset($trace['file']) && isset($trace['line'])) {
  39826. $content .= $this->formatPath($trace['file'], $trace['line']);
  39827. }
  39828. $content .= "</li>\n";
  39829. }
  39830. $content .= " </ol>\n</div>\n";
  39831. }
  39832. } catch (\Exception $e) {
  39833. if ($this->debug) {
  39834. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  39835. } else {
  39836. $title = 'Whoops, looks like something went wrong.';
  39837. }
  39838. }
  39839. }
  39840. return <<<EOF
  39841. <div id="sf-resetcontent" class="sf-reset">
  39842. <h1>$title</h1>
  39843. $content
  39844. </div>
  39845. EOF;
  39846. }
  39847. public function getStylesheet(FlattenException $exception)
  39848. {
  39849. return <<<'EOF'
  39850. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  39851. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  39852. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  39853. .sf-reset .clear_fix { display:inline-block; }
  39854. .sf-reset * html .clear_fix { height:1%; }
  39855. .sf-reset .clear_fix { display:block; }
  39856. .sf-reset, .sf-reset .block { margin: auto }
  39857. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  39858. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  39859. .sf-reset strong { font-weight:bold; }
  39860. .sf-reset a { color:#6c6159; cursor: default; }
  39861. .sf-reset a img { border:none; }
  39862. .sf-reset a:hover { text-decoration:underline; }
  39863. .sf-reset em { font-style:italic; }
  39864. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  39865. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  39866. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  39867. .sf-reset .exception_message { margin-left: 3em; display: block; }
  39868. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  39869. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  39870. -webkit-border-bottom-right-radius: 16px;
  39871. -webkit-border-bottom-left-radius: 16px;
  39872. -moz-border-radius-bottomright: 16px;
  39873. -moz-border-radius-bottomleft: 16px;
  39874. border-bottom-right-radius: 16px;
  39875. border-bottom-left-radius: 16px;
  39876. border-bottom:1px solid #ccc;
  39877. border-right:1px solid #ccc;
  39878. border-left:1px solid #ccc;
  39879. word-wrap: break-word;
  39880. }
  39881. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  39882. -webkit-border-top-left-radius: 16px;
  39883. -webkit-border-top-right-radius: 16px;
  39884. -moz-border-radius-topleft: 16px;
  39885. -moz-border-radius-topright: 16px;
  39886. border-top-left-radius: 16px;
  39887. border-top-right-radius: 16px;
  39888. border-top:1px solid #ccc;
  39889. border-right:1px solid #ccc;
  39890. border-left:1px solid #ccc;
  39891. overflow: hidden;
  39892. word-wrap: break-word;
  39893. }
  39894. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  39895. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  39896. .sf-reset ol { padding: 10px 0; }
  39897. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  39898. -webkit-border-radius: 10px;
  39899. -moz-border-radius: 10px;
  39900. border-radius: 10px;
  39901. border: 1px solid #ccc;
  39902. }
  39903. EOF;
  39904. }
  39905. private function decorate($content, $css)
  39906. {
  39907. return <<<EOF
  39908. <!DOCTYPE html>
  39909. <html>
  39910. <head>
  39911. <meta charset="{$this->charset}" />
  39912. <meta name="robots" content="noindex,nofollow" />
  39913. <style>
  39914. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  39915. 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;}
  39916. html { background: #eee; padding: 10px }
  39917. img { border: 0; }
  39918. #sf-resetcontent { width:970px; margin:0 auto; }
  39919. $css
  39920. </style>
  39921. </head>
  39922. <body>
  39923. $content
  39924. </body>
  39925. </html>
  39926. EOF;
  39927. }
  39928. private function formatClass($class)
  39929. {
  39930. $parts = explode('\\', $class);
  39931. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  39932. }
  39933. private function formatPath($path, $line)
  39934. {
  39935. $path = $this->escapeHtml($path);
  39936. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  39937. if ($linkFormat = $this->fileLinkFormat) {
  39938. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  39939. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  39940. }
  39941. 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);
  39942. }
  39943. private function formatArgs(array $args)
  39944. {
  39945. $result = array();
  39946. foreach ($args as $key => $item) {
  39947. if ('object' === $item[0]) {
  39948. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  39949. } elseif ('array' === $item[0]) {
  39950. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  39951. } elseif ('string' === $item[0]) {
  39952. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  39953. } elseif ('null' === $item[0]) {
  39954. $formattedValue = '<em>null</em>';
  39955. } elseif ('boolean' === $item[0]) {
  39956. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  39957. } elseif ('resource' === $item[0]) {
  39958. $formattedValue = '<em>resource</em>';
  39959. } else {
  39960. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  39961. }
  39962. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  39963. }
  39964. return implode(', ', $result);
  39965. }
  39966. protected static function utf8Htmlize($str)
  39967. {
  39968. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  39969. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  39970. }
  39971. private function escapeHtml($str)
  39972. {
  39973. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  39974. }
  39975. public function catchOutput($buffer)
  39976. {
  39977. $this->caughtBuffer = $buffer;
  39978. return '';
  39979. }
  39980. public function cleanOutput($buffer)
  39981. {
  39982. if ($this->caughtLength) {
  39983. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  39984. if (isset($cleanBuffer[0])) {
  39985. $buffer = $cleanBuffer;
  39986. }
  39987. }
  39988. return $buffer;
  39989. }
  39990. }
  39991. <?php
  39992. namespace Symfony\Component\Debug\FatalErrorHandler;
  39993. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  39994. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  39995. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  39996. use Symfony\Component\Debug\DebugClassLoader;
  39997. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  39998. use Symfony\Component\Debug\Exception\FatalErrorException;
  39999. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  40000. {
  40001. public function handleError(array $error, FatalErrorException $exception)
  40002. {
  40003. $messageLen = \strlen($error['message']);
  40004. $notFoundSuffix = '\' not found';
  40005. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40006. if ($notFoundSuffixLen > $messageLen) {
  40007. return;
  40008. }
  40009. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40010. return;
  40011. }
  40012. foreach (array('class', 'interface', 'trait') as $typeName) {
  40013. $prefix = ucfirst($typeName).' \'';
  40014. $prefixLen = \strlen($prefix);
  40015. if (0 !== strpos($error['message'], $prefix)) {
  40016. continue;
  40017. }
  40018. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40019. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  40020. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  40021. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  40022. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  40023. $tail = ' for another namespace?';
  40024. } else {
  40025. $className = $fullyQualifiedClassName;
  40026. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  40027. $tail = '?';
  40028. }
  40029. if ($candidates = $this->getClassCandidates($className)) {
  40030. $tail = array_pop($candidates).'"?';
  40031. if ($candidates) {
  40032. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  40033. } else {
  40034. $tail = ' for "'.$tail;
  40035. }
  40036. }
  40037. $message .= "\nDid you forget a \"use\" statement".$tail;
  40038. return new ClassNotFoundException($message, $exception);
  40039. }
  40040. }
  40041. private function getClassCandidates($class)
  40042. {
  40043. if (!\is_array($functions = spl_autoload_functions())) {
  40044. return array();
  40045. }
  40046. $classes = array();
  40047. foreach ($functions as $function) {
  40048. if (!\is_array($function)) {
  40049. continue;
  40050. }
  40051. if ($function[0] instanceof DebugClassLoader) {
  40052. $function = $function[0]->getClassLoader();
  40053. if (\is_object($function)) {
  40054. $function = array($function);
  40055. }
  40056. if (!\is_array($function)) {
  40057. continue;
  40058. }
  40059. }
  40060. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  40061. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  40062. foreach ($paths as $path) {
  40063. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40064. }
  40065. }
  40066. }
  40067. if ($function[0] instanceof ComposerClassLoader) {
  40068. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  40069. foreach ($paths as $path) {
  40070. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40071. }
  40072. }
  40073. }
  40074. }
  40075. return array_unique($classes);
  40076. }
  40077. private function findClassInPath($path, $class, $prefix)
  40078. {
  40079. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  40080. return array();
  40081. }
  40082. $classes = array();
  40083. $filename = $class.'.php';
  40084. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  40085. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  40086. $classes[] = $class;
  40087. }
  40088. }
  40089. return $classes;
  40090. }
  40091. private function convertFileToClass($path, $file, $prefix)
  40092. {
  40093. $candidates = array(
  40094. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  40095. $prefix.$namespacedClass,
  40096. $prefix.'\\'.$namespacedClass,
  40097. str_replace('\\', '_', $namespacedClass),
  40098. str_replace('\\', '_', $prefix.$namespacedClass),
  40099. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  40100. );
  40101. if ($prefix) {
  40102. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  40103. }
  40104. foreach ($candidates as $candidate) {
  40105. if ($this->classExists($candidate)) {
  40106. return $candidate;
  40107. }
  40108. }
  40109. require_once $file;
  40110. foreach ($candidates as $candidate) {
  40111. if ($this->classExists($candidate)) {
  40112. return $candidate;
  40113. }
  40114. }
  40115. }
  40116. private function classExists($class)
  40117. {
  40118. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  40119. }
  40120. }
  40121. <?php
  40122. namespace Symfony\Component\Debug\FatalErrorHandler;
  40123. use Symfony\Component\Debug\Exception\FatalErrorException;
  40124. interface FatalErrorHandlerInterface
  40125. {
  40126. public function handleError(array $error, FatalErrorException $exception);
  40127. }
  40128. <?php
  40129. namespace Symfony\Component\Debug\FatalErrorHandler;
  40130. use Symfony\Component\Debug\Exception\FatalErrorException;
  40131. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  40132. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  40133. {
  40134. public function handleError(array $error, FatalErrorException $exception)
  40135. {
  40136. $messageLen = \strlen($error['message']);
  40137. $notFoundSuffix = '()';
  40138. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40139. if ($notFoundSuffixLen > $messageLen) {
  40140. return;
  40141. }
  40142. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40143. return;
  40144. }
  40145. $prefix = 'Call to undefined function ';
  40146. $prefixLen = \strlen($prefix);
  40147. if (0 !== strpos($error['message'], $prefix)) {
  40148. return;
  40149. }
  40150. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40151. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  40152. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  40153. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  40154. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  40155. } else {
  40156. $functionName = $fullyQualifiedFunctionName;
  40157. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  40158. }
  40159. $candidates = array();
  40160. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  40161. foreach ($definedFunctionNames as $definedFunctionName) {
  40162. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  40163. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  40164. } else {
  40165. $definedFunctionNameBasename = $definedFunctionName;
  40166. }
  40167. if ($definedFunctionNameBasename === $functionName) {
  40168. $candidates[] = '\\'.$definedFunctionName;
  40169. }
  40170. }
  40171. }
  40172. if ($candidates) {
  40173. sort($candidates);
  40174. $last = array_pop($candidates).'"?';
  40175. if ($candidates) {
  40176. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40177. } else {
  40178. $candidates = '"'.$last;
  40179. }
  40180. $message .= "\nDid you mean to call ".$candidates;
  40181. }
  40182. return new UndefinedFunctionException($message, $exception);
  40183. }
  40184. }
  40185. <?php
  40186. namespace Symfony\Component\Debug\FatalErrorHandler;
  40187. use Symfony\Component\Debug\Exception\FatalErrorException;
  40188. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  40189. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  40190. {
  40191. public function handleError(array $error, FatalErrorException $exception)
  40192. {
  40193. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  40194. if (!$matches) {
  40195. return;
  40196. }
  40197. $className = $matches[1];
  40198. $methodName = $matches[2];
  40199. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  40200. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  40201. return new UndefinedMethodException($message, $exception);
  40202. }
  40203. $candidates = array();
  40204. foreach ($methods as $definedMethodName) {
  40205. $lev = levenshtein($methodName, $definedMethodName);
  40206. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  40207. $candidates[] = $definedMethodName;
  40208. }
  40209. }
  40210. if ($candidates) {
  40211. sort($candidates);
  40212. $last = array_pop($candidates).'"?';
  40213. if ($candidates) {
  40214. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40215. } else {
  40216. $candidates = '"'.$last;
  40217. }
  40218. $message .= "\nDid you mean to call ".$candidates;
  40219. }
  40220. return new UndefinedMethodException($message, $exception);
  40221. }
  40222. }
  40223. Copyright (c) 2004-2018 Fabien Potencier
  40224. Permission is hereby granted, free of charge, to any person obtaining a copy
  40225. of this software and associated documentation files (the "Software"), to deal
  40226. in the Software without restriction, including without limitation the rights
  40227. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40228. copies of the Software, and to permit persons to whom the Software is furnished
  40229. to do so, subject to the following conditions:
  40230. The above copyright notice and this permission notice shall be included in all
  40231. copies or substantial portions of the Software.
  40232. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40233. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40234. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40235. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40236. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40237. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40238. THE SOFTWARE.
  40239. <?php
  40240. namespace Symfony\Component\Filesystem\Exception;
  40241. interface ExceptionInterface
  40242. {
  40243. }
  40244. <?php
  40245. namespace Symfony\Component\Filesystem\Exception;
  40246. class FileNotFoundException extends IOException
  40247. {
  40248. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  40249. {
  40250. if (null === $message) {
  40251. if (null === $path) {
  40252. $message = 'File could not be found.';
  40253. } else {
  40254. $message = sprintf('File "%s" could not be found.', $path);
  40255. }
  40256. }
  40257. parent::__construct($message, $code, $previous, $path);
  40258. }
  40259. }
  40260. <?php
  40261. namespace Symfony\Component\Filesystem\Exception;
  40262. class IOException extends \RuntimeException implements IOExceptionInterface
  40263. {
  40264. private $path;
  40265. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  40266. {
  40267. $this->path = $path;
  40268. parent::__construct($message, $code, $previous);
  40269. }
  40270. public function getPath()
  40271. {
  40272. return $this->path;
  40273. }
  40274. }
  40275. <?php
  40276. namespace Symfony\Component\Filesystem\Exception;
  40277. interface IOExceptionInterface extends ExceptionInterface
  40278. {
  40279. public function getPath();
  40280. }
  40281. <?php
  40282. namespace Symfony\Component\Filesystem;
  40283. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  40284. use Symfony\Component\Filesystem\Exception\IOException;
  40285. class Filesystem
  40286. {
  40287. private static $lastError;
  40288. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  40289. {
  40290. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  40291. if ($originIsLocal && !is_file($originFile)) {
  40292. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  40293. }
  40294. $this->mkdir(\dirname($targetFile));
  40295. $doCopy = true;
  40296. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  40297. $doCopy = filemtime($originFile) > filemtime($targetFile);
  40298. }
  40299. if ($doCopy) {
  40300. if (false === $source = @fopen($originFile, 'r')) {
  40301. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  40302. }
  40303. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  40304. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  40305. }
  40306. $bytesCopied = stream_copy_to_stream($source, $target);
  40307. fclose($source);
  40308. fclose($target);
  40309. unset($source, $target);
  40310. if (!is_file($targetFile)) {
  40311. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  40312. }
  40313. if ($originIsLocal) {
  40314. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  40315. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  40316. 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);
  40317. }
  40318. }
  40319. }
  40320. }
  40321. public function mkdir($dirs, $mode = 0777)
  40322. {
  40323. foreach ($this->toIterator($dirs) as $dir) {
  40324. if (is_dir($dir)) {
  40325. continue;
  40326. }
  40327. if (!self::box('mkdir', $dir, $mode, true)) {
  40328. if (!is_dir($dir)) {
  40329. if (self::$lastError) {
  40330. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  40331. }
  40332. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  40333. }
  40334. }
  40335. }
  40336. }
  40337. public function exists($files)
  40338. {
  40339. $maxPathLength = PHP_MAXPATHLEN - 2;
  40340. foreach ($this->toIterator($files) as $file) {
  40341. if (\strlen($file) > $maxPathLength) {
  40342. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  40343. }
  40344. if (!file_exists($file)) {
  40345. return false;
  40346. }
  40347. }
  40348. return true;
  40349. }
  40350. public function touch($files, $time = null, $atime = null)
  40351. {
  40352. foreach ($this->toIterator($files) as $file) {
  40353. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  40354. if (true !== $touch) {
  40355. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  40356. }
  40357. }
  40358. }
  40359. public function remove($files)
  40360. {
  40361. if ($files instanceof \Traversable) {
  40362. $files = iterator_to_array($files, false);
  40363. } elseif (!\is_array($files)) {
  40364. $files = array($files);
  40365. }
  40366. $files = array_reverse($files);
  40367. foreach ($files as $file) {
  40368. if (is_link($file)) {
  40369. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  40370. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  40371. }
  40372. } elseif (is_dir($file)) {
  40373. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  40374. if (!self::box('rmdir', $file) && file_exists($file)) {
  40375. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  40376. }
  40377. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  40378. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  40379. }
  40380. }
  40381. }
  40382. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  40383. {
  40384. foreach ($this->toIterator($files) as $file) {
  40385. if (true !== @chmod($file, $mode & ~$umask)) {
  40386. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  40387. }
  40388. if ($recursive && is_dir($file) && !is_link($file)) {
  40389. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  40390. }
  40391. }
  40392. }
  40393. public function chown($files, $user, $recursive = false)
  40394. {
  40395. foreach ($this->toIterator($files) as $file) {
  40396. if ($recursive && is_dir($file) && !is_link($file)) {
  40397. $this->chown(new \FilesystemIterator($file), $user, true);
  40398. }
  40399. if (is_link($file) && \function_exists('lchown')) {
  40400. if (true !== @lchown($file, $user)) {
  40401. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40402. }
  40403. } else {
  40404. if (true !== @chown($file, $user)) {
  40405. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40406. }
  40407. }
  40408. }
  40409. }
  40410. public function chgrp($files, $group, $recursive = false)
  40411. {
  40412. foreach ($this->toIterator($files) as $file) {
  40413. if ($recursive && is_dir($file) && !is_link($file)) {
  40414. $this->chgrp(new \FilesystemIterator($file), $group, true);
  40415. }
  40416. if (is_link($file) && \function_exists('lchgrp')) {
  40417. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  40418. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40419. }
  40420. } else {
  40421. if (true !== @chgrp($file, $group)) {
  40422. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40423. }
  40424. }
  40425. }
  40426. }
  40427. public function rename($origin, $target, $overwrite = false)
  40428. {
  40429. if (!$overwrite && $this->isReadable($target)) {
  40430. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  40431. }
  40432. if (true !== @rename($origin, $target)) {
  40433. if (is_dir($origin)) {
  40434. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  40435. $this->remove($origin);
  40436. return;
  40437. }
  40438. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  40439. }
  40440. }
  40441. private function isReadable($filename)
  40442. {
  40443. $maxPathLength = PHP_MAXPATHLEN - 2;
  40444. if (\strlen($filename) > $maxPathLength) {
  40445. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  40446. }
  40447. return is_readable($filename);
  40448. }
  40449. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  40450. {
  40451. if ('\\' === \DIRECTORY_SEPARATOR) {
  40452. $originDir = strtr($originDir, '/', '\\');
  40453. $targetDir = strtr($targetDir, '/', '\\');
  40454. if ($copyOnWindows) {
  40455. $this->mirror($originDir, $targetDir);
  40456. return;
  40457. }
  40458. }
  40459. $this->mkdir(\dirname($targetDir));
  40460. if (is_link($targetDir)) {
  40461. if (readlink($targetDir) === $originDir) {
  40462. return;
  40463. }
  40464. $this->remove($targetDir);
  40465. }
  40466. if (!self::box('symlink', $originDir, $targetDir)) {
  40467. if (null !== self::$lastError) {
  40468. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  40469. 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);
  40470. }
  40471. }
  40472. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  40473. }
  40474. }
  40475. public function makePathRelative($endPath, $startPath)
  40476. {
  40477. if ('\\' === \DIRECTORY_SEPARATOR) {
  40478. $endPath = str_replace('\\', '/', $endPath);
  40479. $startPath = str_replace('\\', '/', $startPath);
  40480. }
  40481. $stripDriveLetter = function ($path) {
  40482. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  40483. return substr($path, 2);
  40484. }
  40485. return $path;
  40486. };
  40487. $endPath = $stripDriveLetter($endPath);
  40488. $startPath = $stripDriveLetter($startPath);
  40489. $startPathArr = explode('/', trim($startPath, '/'));
  40490. $endPathArr = explode('/', trim($endPath, '/'));
  40491. $normalizePathArray = function ($pathSegments, $absolute) {
  40492. $result = array();
  40493. foreach ($pathSegments as $segment) {
  40494. if ('..' === $segment && ($absolute || \count($result))) {
  40495. array_pop($result);
  40496. } elseif ('.' !== $segment) {
  40497. $result[] = $segment;
  40498. }
  40499. }
  40500. return $result;
  40501. };
  40502. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  40503. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  40504. $index = 0;
  40505. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  40506. ++$index;
  40507. }
  40508. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  40509. $depth = 0;
  40510. } else {
  40511. $depth = \count($startPathArr) - $index;
  40512. }
  40513. $traverser = str_repeat('../', $depth);
  40514. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  40515. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  40516. return '' === $relativePath ? './' : $relativePath;
  40517. }
  40518. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  40519. {
  40520. $targetDir = rtrim($targetDir, '/\\');
  40521. $originDir = rtrim($originDir, '/\\');
  40522. $originDirLen = \strlen($originDir);
  40523. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  40524. $deleteIterator = $iterator;
  40525. if (null === $deleteIterator) {
  40526. $flags = \FilesystemIterator::SKIP_DOTS;
  40527. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  40528. }
  40529. $targetDirLen = \strlen($targetDir);
  40530. foreach ($deleteIterator as $file) {
  40531. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  40532. if (!$this->exists($origin)) {
  40533. $this->remove($file);
  40534. }
  40535. }
  40536. }
  40537. $copyOnWindows = false;
  40538. if (isset($options['copy_on_windows'])) {
  40539. $copyOnWindows = $options['copy_on_windows'];
  40540. }
  40541. if (null === $iterator) {
  40542. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  40543. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  40544. }
  40545. if ($this->exists($originDir)) {
  40546. $this->mkdir($targetDir);
  40547. }
  40548. foreach ($iterator as $file) {
  40549. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  40550. if ($copyOnWindows) {
  40551. if (is_file($file)) {
  40552. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40553. } elseif (is_dir($file)) {
  40554. $this->mkdir($target);
  40555. } else {
  40556. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40557. }
  40558. } else {
  40559. if (is_link($file)) {
  40560. $this->symlink($file->getLinkTarget(), $target);
  40561. } elseif (is_dir($file)) {
  40562. $this->mkdir($target);
  40563. } elseif (is_file($file)) {
  40564. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40565. } else {
  40566. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40567. }
  40568. }
  40569. }
  40570. }
  40571. public function isAbsolutePath($file)
  40572. {
  40573. return strspn($file, '/\\', 0, 1)
  40574. || (\strlen($file) > 3 && ctype_alpha($file[0])
  40575. && ':' === substr($file, 1, 1)
  40576. && strspn($file, '/\\', 2, 1)
  40577. )
  40578. || null !== parse_url($file, PHP_URL_SCHEME)
  40579. ;
  40580. }
  40581. public function tempnam($dir, $prefix)
  40582. {
  40583. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  40584. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  40585. $tmpFile = @tempnam($hierarchy, $prefix);
  40586. if (false !== $tmpFile) {
  40587. if (null !== $scheme && 'gs' !== $scheme) {
  40588. return $scheme.'://'.$tmpFile;
  40589. }
  40590. return $tmpFile;
  40591. }
  40592. throw new IOException('A temporary file could not be created.');
  40593. }
  40594. for ($i = 0; $i < 10; ++$i) {
  40595. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  40596. $handle = @fopen($tmpFile, 'x+');
  40597. if (false === $handle) {
  40598. continue;
  40599. }
  40600. @fclose($handle);
  40601. return $tmpFile;
  40602. }
  40603. throw new IOException('A temporary file could not be created.');
  40604. }
  40605. public function dumpFile($filename, $content, $mode = 0666)
  40606. {
  40607. $dir = \dirname($filename);
  40608. if (!is_dir($dir)) {
  40609. $this->mkdir($dir);
  40610. }
  40611. if (!is_writable($dir)) {
  40612. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  40613. }
  40614. $tmpFile = $this->tempnam($dir, basename($filename));
  40615. if (false === @file_put_contents($tmpFile, $content)) {
  40616. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  40617. }
  40618. if (null !== $mode) {
  40619. if (\func_num_args() > 2) {
  40620. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  40621. }
  40622. $this->chmod($tmpFile, $mode);
  40623. } elseif (file_exists($filename)) {
  40624. @chmod($tmpFile, fileperms($filename));
  40625. }
  40626. $this->rename($tmpFile, $filename, true);
  40627. }
  40628. private function toIterator($files)
  40629. {
  40630. if (!$files instanceof \Traversable) {
  40631. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  40632. }
  40633. return $files;
  40634. }
  40635. private function getSchemeAndHierarchy($filename)
  40636. {
  40637. $components = explode('://', $filename, 2);
  40638. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  40639. }
  40640. private static function box($func)
  40641. {
  40642. self::$lastError = null;
  40643. \set_error_handler(__CLASS__.'::handleError');
  40644. try {
  40645. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  40646. \restore_error_handler();
  40647. return $result;
  40648. } catch (\Throwable $e) {
  40649. } catch (\Exception $e) {
  40650. }
  40651. \restore_error_handler();
  40652. throw $e;
  40653. }
  40654. public static function handleError($type, $msg)
  40655. {
  40656. self::$lastError = $msg;
  40657. }
  40658. }
  40659. Copyright (c) 2004-2018 Fabien Potencier
  40660. Permission is hereby granted, free of charge, to any person obtaining a copy
  40661. of this software and associated documentation files (the "Software"), to deal
  40662. in the Software without restriction, including without limitation the rights
  40663. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40664. copies of the Software, and to permit persons to whom the Software is furnished
  40665. to do so, subject to the following conditions:
  40666. The above copyright notice and this permission notice shall be included in all
  40667. copies or substantial portions of the Software.
  40668. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40669. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40670. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40671. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40672. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40673. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40674. THE SOFTWARE.
  40675. <?php
  40676. namespace Symfony\Component\Filesystem;
  40677. use Symfony\Component\Filesystem\Exception\IOException;
  40678. class LockHandler
  40679. {
  40680. private $file;
  40681. private $handle;
  40682. public function __construct($name, $lockPath = null)
  40683. {
  40684. $lockPath = $lockPath ?: sys_get_temp_dir();
  40685. if (!is_dir($lockPath)) {
  40686. $fs = new Filesystem();
  40687. $fs->mkdir($lockPath);
  40688. }
  40689. if (!is_writable($lockPath)) {
  40690. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  40691. }
  40692. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  40693. }
  40694. public function lock($blocking = false)
  40695. {
  40696. if ($this->handle) {
  40697. return true;
  40698. }
  40699. $error = null;
  40700. set_error_handler(function ($errno, $msg) use (&$error) {
  40701. $error = $msg;
  40702. });
  40703. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40704. if ($this->handle = fopen($this->file, 'x')) {
  40705. chmod($this->file, 0666);
  40706. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40707. usleep(100);
  40708. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  40709. }
  40710. }
  40711. restore_error_handler();
  40712. if (!$this->handle) {
  40713. throw new IOException($error, 0, null, $this->file);
  40714. }
  40715. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  40716. fclose($this->handle);
  40717. $this->handle = null;
  40718. return false;
  40719. }
  40720. return true;
  40721. }
  40722. public function release()
  40723. {
  40724. if ($this->handle) {
  40725. flock($this->handle, LOCK_UN | LOCK_NB);
  40726. fclose($this->handle);
  40727. $this->handle = null;
  40728. }
  40729. }
  40730. }
  40731. <?php
  40732. namespace Symfony\Component\Finder\Adapter;
  40733. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40734. abstract class AbstractAdapter implements AdapterInterface
  40735. {
  40736. protected $followLinks = false;
  40737. protected $mode = 0;
  40738. protected $minDepth = 0;
  40739. protected $maxDepth = PHP_INT_MAX;
  40740. protected $exclude = array();
  40741. protected $names = array();
  40742. protected $notNames = array();
  40743. protected $contains = array();
  40744. protected $notContains = array();
  40745. protected $sizes = array();
  40746. protected $dates = array();
  40747. protected $filters = array();
  40748. protected $sort = false;
  40749. protected $paths = array();
  40750. protected $notPaths = array();
  40751. protected $ignoreUnreadableDirs = false;
  40752. private static $areSupported = array();
  40753. public function isSupported()
  40754. {
  40755. $name = $this->getName();
  40756. if (!array_key_exists($name, self::$areSupported)) {
  40757. self::$areSupported[$name] = $this->canBeUsed();
  40758. }
  40759. return self::$areSupported[$name];
  40760. }
  40761. public function setFollowLinks($followLinks)
  40762. {
  40763. $this->followLinks = $followLinks;
  40764. return $this;
  40765. }
  40766. public function setMode($mode)
  40767. {
  40768. $this->mode = $mode;
  40769. return $this;
  40770. }
  40771. public function setDepths(array $depths)
  40772. {
  40773. $this->minDepth = 0;
  40774. $this->maxDepth = PHP_INT_MAX;
  40775. foreach ($depths as $comparator) {
  40776. switch ($comparator->getOperator()) {
  40777. case '>':
  40778. $this->minDepth = $comparator->getTarget() + 1;
  40779. break;
  40780. case '>=':
  40781. $this->minDepth = $comparator->getTarget();
  40782. break;
  40783. case '<':
  40784. $this->maxDepth = $comparator->getTarget() - 1;
  40785. break;
  40786. case '<=':
  40787. $this->maxDepth = $comparator->getTarget();
  40788. break;
  40789. default:
  40790. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  40791. }
  40792. }
  40793. return $this;
  40794. }
  40795. public function setExclude(array $exclude)
  40796. {
  40797. $this->exclude = $exclude;
  40798. return $this;
  40799. }
  40800. public function setNames(array $names)
  40801. {
  40802. $this->names = $names;
  40803. return $this;
  40804. }
  40805. public function setNotNames(array $notNames)
  40806. {
  40807. $this->notNames = $notNames;
  40808. return $this;
  40809. }
  40810. public function setContains(array $contains)
  40811. {
  40812. $this->contains = $contains;
  40813. return $this;
  40814. }
  40815. public function setNotContains(array $notContains)
  40816. {
  40817. $this->notContains = $notContains;
  40818. return $this;
  40819. }
  40820. public function setSizes(array $sizes)
  40821. {
  40822. $this->sizes = $sizes;
  40823. return $this;
  40824. }
  40825. public function setDates(array $dates)
  40826. {
  40827. $this->dates = $dates;
  40828. return $this;
  40829. }
  40830. public function setFilters(array $filters)
  40831. {
  40832. $this->filters = $filters;
  40833. return $this;
  40834. }
  40835. public function setSort($sort)
  40836. {
  40837. $this->sort = $sort;
  40838. return $this;
  40839. }
  40840. public function setPath(array $paths)
  40841. {
  40842. $this->paths = $paths;
  40843. return $this;
  40844. }
  40845. public function setNotPath(array $notPaths)
  40846. {
  40847. $this->notPaths = $notPaths;
  40848. return $this;
  40849. }
  40850. public function ignoreUnreadableDirs($ignore = true)
  40851. {
  40852. $this->ignoreUnreadableDirs = (bool) $ignore;
  40853. return $this;
  40854. }
  40855. abstract protected function canBeUsed();
  40856. }
  40857. <?php
  40858. namespace Symfony\Component\Finder\Adapter;
  40859. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40860. use Symfony\Component\Finder\Comparator\DateComparator;
  40861. use Symfony\Component\Finder\Comparator\NumberComparator;
  40862. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40863. use Symfony\Component\Finder\Expression\Expression;
  40864. use Symfony\Component\Finder\Iterator;
  40865. use Symfony\Component\Finder\Shell\Command;
  40866. use Symfony\Component\Finder\Shell\Shell;
  40867. abstract class AbstractFindAdapter extends AbstractAdapter
  40868. {
  40869. protected $shell;
  40870. public function __construct()
  40871. {
  40872. $this->shell = new Shell();
  40873. }
  40874. public function searchInDirectory($dir)
  40875. {
  40876. $dir = realpath($dir);
  40877. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  40878. return new Iterator\FilePathsIterator(array(), $dir);
  40879. }
  40880. $command = Command::create();
  40881. $find = $this->buildFindCommand($command, $dir);
  40882. if ($this->followLinks) {
  40883. $find->add('-follow');
  40884. }
  40885. $find->add('-mindepth')->add($this->minDepth + 1);
  40886. if (PHP_INT_MAX !== $this->maxDepth) {
  40887. $find->add('-maxdepth')->add($this->maxDepth + 1);
  40888. }
  40889. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  40890. $find->add('-type d');
  40891. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  40892. $find->add('-type f');
  40893. }
  40894. $this->buildNamesFiltering($find, $this->names);
  40895. $this->buildNamesFiltering($find, $this->notNames, true);
  40896. $this->buildPathsFiltering($find, $dir, $this->paths);
  40897. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  40898. $this->buildSizesFiltering($find, $this->sizes);
  40899. $this->buildDatesFiltering($find, $this->dates);
  40900. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  40901. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  40902. if ($useGrep && ($this->contains || $this->notContains)) {
  40903. $grep = $command->ins('grep');
  40904. $this->buildContentFiltering($grep, $this->contains);
  40905. $this->buildContentFiltering($grep, $this->notContains, true);
  40906. }
  40907. if ($useSort) {
  40908. $this->buildSorting($command, $this->sort);
  40909. }
  40910. $command->setErrorHandler(
  40911. $this->ignoreUnreadableDirs
  40912. ? function ($stderr) { }
  40913. : function ($stderr) { throw new AccessDeniedException($stderr); }
  40914. );
  40915. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  40916. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  40917. if ($this->exclude) {
  40918. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40919. }
  40920. if (!$useGrep && ($this->contains || $this->notContains)) {
  40921. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40922. }
  40923. if ($this->filters) {
  40924. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40925. }
  40926. if (!$useSort && $this->sort) {
  40927. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40928. $iterator = $iteratorAggregate->getIterator();
  40929. }
  40930. return $iterator;
  40931. }
  40932. protected function canBeUsed()
  40933. {
  40934. return $this->shell->testCommand('find');
  40935. }
  40936. protected function buildFindCommand(Command $command, $dir)
  40937. {
  40938. return $command
  40939. ->ins('find')
  40940. ->add('find ')
  40941. ->arg($dir)
  40942. ->add('-noleaf');
  40943. }
  40944. private function buildNamesFiltering(Command $command, array $names, $not = false)
  40945. {
  40946. if (0 === \count($names)) {
  40947. return;
  40948. }
  40949. $command->add($not ? '-not' : null)->cmd('(');
  40950. foreach ($names as $i => $name) {
  40951. $expr = Expression::create($name);
  40952. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40953. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40954. }
  40955. if ($expr->isRegex()) {
  40956. $regex = $expr->getRegex();
  40957. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  40958. ->setStartFlag(false)
  40959. ->setStartJoker(true)
  40960. ->replaceJokers('[^/]');
  40961. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  40962. $regex->setEndJoker(false)->append('[^/]*');
  40963. }
  40964. }
  40965. $command
  40966. ->add($i > 0 ? '-or' : null)
  40967. ->add($expr->isRegex()
  40968. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40969. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  40970. )
  40971. ->arg($expr->renderPattern());
  40972. }
  40973. $command->cmd(')');
  40974. }
  40975. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  40976. {
  40977. if (0 === \count($paths)) {
  40978. return;
  40979. }
  40980. $command->add($not ? '-not' : null)->cmd('(');
  40981. foreach ($paths as $i => $path) {
  40982. $expr = Expression::create($path);
  40983. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40984. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40985. }
  40986. if ($expr->isRegex()) {
  40987. $regex = $expr->getRegex();
  40988. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  40989. } else {
  40990. $expr->prepend('*')->append('*');
  40991. }
  40992. $command
  40993. ->add($i > 0 ? '-or' : null)
  40994. ->add($expr->isRegex()
  40995. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40996. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  40997. )
  40998. ->arg($expr->renderPattern());
  40999. }
  41000. $command->cmd(')');
  41001. }
  41002. private function buildSizesFiltering(Command $command, array $sizes)
  41003. {
  41004. foreach ($sizes as $i => $size) {
  41005. $command->add($i > 0 ? '-and' : null);
  41006. switch ($size->getOperator()) {
  41007. case '<=':
  41008. $command->add('-size -'.($size->getTarget() + 1).'c');
  41009. break;
  41010. case '>=':
  41011. $command->add('-size +'.($size->getTarget() - 1).'c');
  41012. break;
  41013. case '>':
  41014. $command->add('-size +'.$size->getTarget().'c');
  41015. break;
  41016. case '!=':
  41017. $command->add('-size -'.$size->getTarget().'c');
  41018. $command->add('-size +'.$size->getTarget().'c');
  41019. break;
  41020. case '<':
  41021. default:
  41022. $command->add('-size -'.$size->getTarget().'c');
  41023. }
  41024. }
  41025. }
  41026. private function buildDatesFiltering(Command $command, array $dates)
  41027. {
  41028. foreach ($dates as $i => $date) {
  41029. $command->add($i > 0 ? '-and' : null);
  41030. $mins = (int) round((time() - $date->getTarget()) / 60);
  41031. if (0 > $mins) {
  41032. $command->add(' -mmin -0');
  41033. return;
  41034. }
  41035. switch ($date->getOperator()) {
  41036. case '<=':
  41037. $command->add('-mmin +'.($mins - 1));
  41038. break;
  41039. case '>=':
  41040. $command->add('-mmin -'.($mins + 1));
  41041. break;
  41042. case '>':
  41043. $command->add('-mmin -'.$mins);
  41044. break;
  41045. case '!=':
  41046. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  41047. break;
  41048. case '<':
  41049. default:
  41050. $command->add('-mmin +'.$mins);
  41051. }
  41052. }
  41053. }
  41054. private function buildSorting(Command $command, $sort)
  41055. {
  41056. $this->buildFormatSorting($command, $sort);
  41057. }
  41058. abstract protected function buildFormatSorting(Command $command, $sort);
  41059. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  41060. }
  41061. <?php
  41062. namespace Symfony\Component\Finder\Adapter;
  41063. interface AdapterInterface
  41064. {
  41065. public function setFollowLinks($followLinks);
  41066. public function setMode($mode);
  41067. public function setExclude(array $exclude);
  41068. public function setDepths(array $depths);
  41069. public function setNames(array $names);
  41070. public function setNotNames(array $notNames);
  41071. public function setContains(array $contains);
  41072. public function setNotContains(array $notContains);
  41073. public function setSizes(array $sizes);
  41074. public function setDates(array $dates);
  41075. public function setFilters(array $filters);
  41076. public function setSort($sort);
  41077. public function setPath(array $paths);
  41078. public function setNotPath(array $notPaths);
  41079. public function ignoreUnreadableDirs($ignore = true);
  41080. public function searchInDirectory($dir);
  41081. public function isSupported();
  41082. public function getName();
  41083. }
  41084. <?php
  41085. namespace Symfony\Component\Finder\Adapter;
  41086. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  41087. use Symfony\Component\Finder\Expression\Expression;
  41088. use Symfony\Component\Finder\Iterator\SortableIterator;
  41089. use Symfony\Component\Finder\Shell\Command;
  41090. use Symfony\Component\Finder\Shell\Shell;
  41091. class BsdFindAdapter extends AbstractFindAdapter
  41092. {
  41093. public function getName()
  41094. {
  41095. return 'bsd_find';
  41096. }
  41097. protected function canBeUsed()
  41098. {
  41099. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  41100. }
  41101. protected function buildFormatSorting(Command $command, $sort)
  41102. {
  41103. switch ($sort) {
  41104. case SortableIterator::SORT_BY_NAME:
  41105. $command->ins('sort')->add('| sort');
  41106. return;
  41107. case SortableIterator::SORT_BY_TYPE:
  41108. $format = '%HT';
  41109. break;
  41110. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41111. $format = '%a';
  41112. break;
  41113. case SortableIterator::SORT_BY_CHANGED_TIME:
  41114. $format = '%c';
  41115. break;
  41116. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41117. $format = '%m';
  41118. break;
  41119. default:
  41120. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41121. }
  41122. $command
  41123. ->add('-print0 | xargs -0 stat -f')
  41124. ->arg($format.'%t%N')
  41125. ->add('| sort | cut -f 2');
  41126. }
  41127. protected function buildFindCommand(Command $command, $dir)
  41128. {
  41129. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  41130. return $command;
  41131. }
  41132. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41133. {
  41134. foreach ($contains as $contain) {
  41135. $expr = Expression::create($contain);
  41136. $command
  41137. ->add('| grep -v \'^$\'')
  41138. ->add('| xargs -I{} grep -I')
  41139. ->add($expr->isCaseSensitive() ? null : '-i')
  41140. ->add($not ? '-L' : '-l')
  41141. ->add('-Ee')->arg($expr->renderPattern())
  41142. ->add('{}')
  41143. ;
  41144. }
  41145. }
  41146. }
  41147. <?php
  41148. namespace Symfony\Component\Finder\Adapter;
  41149. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  41150. use Symfony\Component\Finder\Expression\Expression;
  41151. use Symfony\Component\Finder\Iterator\SortableIterator;
  41152. use Symfony\Component\Finder\Shell\Command;
  41153. use Symfony\Component\Finder\Shell\Shell;
  41154. class GnuFindAdapter extends AbstractFindAdapter
  41155. {
  41156. public function getName()
  41157. {
  41158. return 'gnu_find';
  41159. }
  41160. protected function buildFormatSorting(Command $command, $sort)
  41161. {
  41162. switch ($sort) {
  41163. case SortableIterator::SORT_BY_NAME:
  41164. $command->ins('sort')->add('| sort');
  41165. return;
  41166. case SortableIterator::SORT_BY_TYPE:
  41167. $format = '%y';
  41168. break;
  41169. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41170. $format = '%A@';
  41171. break;
  41172. case SortableIterator::SORT_BY_CHANGED_TIME:
  41173. $format = '%C@';
  41174. break;
  41175. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41176. $format = '%T@';
  41177. break;
  41178. default:
  41179. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41180. }
  41181. $command
  41182. ->get('find')
  41183. ->add('-printf')
  41184. ->arg($format.' %h/%f\\n')
  41185. ->add('| sort | cut')
  41186. ->arg('-d ')
  41187. ->arg('-f2-')
  41188. ;
  41189. }
  41190. protected function canBeUsed()
  41191. {
  41192. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  41193. }
  41194. protected function buildFindCommand(Command $command, $dir)
  41195. {
  41196. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  41197. }
  41198. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41199. {
  41200. foreach ($contains as $contain) {
  41201. $expr = Expression::create($contain);
  41202. $command
  41203. ->add('| xargs -I{} -r grep -I')
  41204. ->add($expr->isCaseSensitive() ? null : '-i')
  41205. ->add($not ? '-L' : '-l')
  41206. ->add('-Ee')->arg($expr->renderPattern())
  41207. ->add('{}')
  41208. ;
  41209. }
  41210. }
  41211. }
  41212. <?php
  41213. namespace Symfony\Component\Finder\Adapter;
  41214. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  41215. use Symfony\Component\Finder\Iterator;
  41216. class PhpAdapter extends AbstractAdapter
  41217. {
  41218. public function searchInDirectory($dir)
  41219. {
  41220. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41221. if ($this->followLinks) {
  41222. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41223. }
  41224. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41225. if ($this->exclude) {
  41226. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41227. }
  41228. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41229. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  41230. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  41231. }
  41232. if ($this->mode) {
  41233. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41234. }
  41235. if ($this->names || $this->notNames) {
  41236. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41237. }
  41238. if ($this->contains || $this->notContains) {
  41239. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41240. }
  41241. if ($this->sizes) {
  41242. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41243. }
  41244. if ($this->dates) {
  41245. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41246. }
  41247. if ($this->filters) {
  41248. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41249. }
  41250. if ($this->paths || $this->notPaths) {
  41251. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41252. }
  41253. if ($this->sort) {
  41254. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41255. $iterator = $iteratorAggregate->getIterator();
  41256. }
  41257. return $iterator;
  41258. }
  41259. public function getName()
  41260. {
  41261. return 'php';
  41262. }
  41263. protected function canBeUsed()
  41264. {
  41265. return true;
  41266. }
  41267. }
  41268. <?php
  41269. namespace Symfony\Component\Finder\Comparator;
  41270. class Comparator
  41271. {
  41272. private $target;
  41273. private $operator = '==';
  41274. public function getTarget()
  41275. {
  41276. return $this->target;
  41277. }
  41278. public function setTarget($target)
  41279. {
  41280. $this->target = $target;
  41281. }
  41282. public function getOperator()
  41283. {
  41284. return $this->operator;
  41285. }
  41286. public function setOperator($operator)
  41287. {
  41288. if (!$operator) {
  41289. $operator = '==';
  41290. }
  41291. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  41292. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  41293. }
  41294. $this->operator = $operator;
  41295. }
  41296. public function test($test)
  41297. {
  41298. switch ($this->operator) {
  41299. case '>':
  41300. return $test > $this->target;
  41301. case '>=':
  41302. return $test >= $this->target;
  41303. case '<':
  41304. return $test < $this->target;
  41305. case '<=':
  41306. return $test <= $this->target;
  41307. case '!=':
  41308. return $test != $this->target;
  41309. }
  41310. return $test == $this->target;
  41311. }
  41312. }
  41313. <?php
  41314. namespace Symfony\Component\Finder\Comparator;
  41315. class DateComparator extends Comparator
  41316. {
  41317. public function __construct($test)
  41318. {
  41319. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  41320. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  41321. }
  41322. try {
  41323. $date = new \DateTime($matches[2]);
  41324. $target = $date->format('U');
  41325. } catch (\Exception $e) {
  41326. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  41327. }
  41328. $operator = isset($matches[1]) ? $matches[1] : '==';
  41329. if ('since' === $operator || 'after' === $operator) {
  41330. $operator = '>';
  41331. }
  41332. if ('until' === $operator || 'before' === $operator) {
  41333. $operator = '<';
  41334. }
  41335. $this->setOperator($operator);
  41336. $this->setTarget($target);
  41337. }
  41338. }
  41339. <?php
  41340. namespace Symfony\Component\Finder\Comparator;
  41341. class NumberComparator extends Comparator
  41342. {
  41343. public function __construct($test)
  41344. {
  41345. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  41346. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  41347. }
  41348. $target = $matches[2];
  41349. if (!is_numeric($target)) {
  41350. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  41351. }
  41352. if (isset($matches[3])) {
  41353. switch (strtolower($matches[3])) {
  41354. case 'k':
  41355. $target *= 1000;
  41356. break;
  41357. case 'ki':
  41358. $target *= 1024;
  41359. break;
  41360. case 'm':
  41361. $target *= 1000000;
  41362. break;
  41363. case 'mi':
  41364. $target *= 1024 * 1024;
  41365. break;
  41366. case 'g':
  41367. $target *= 1000000000;
  41368. break;
  41369. case 'gi':
  41370. $target *= 1024 * 1024 * 1024;
  41371. break;
  41372. }
  41373. }
  41374. $this->setTarget($target);
  41375. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  41376. }
  41377. }
  41378. <?php
  41379. namespace Symfony\Component\Finder\Exception;
  41380. class AccessDeniedException extends \UnexpectedValueException
  41381. {
  41382. }
  41383. <?php
  41384. namespace Symfony\Component\Finder\Exception;
  41385. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41386. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41387. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  41388. {
  41389. private $adapter;
  41390. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  41391. {
  41392. $this->adapter = $adapter;
  41393. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  41394. }
  41395. public function getAdapter()
  41396. {
  41397. return $this->adapter;
  41398. }
  41399. }
  41400. <?php
  41401. namespace Symfony\Component\Finder\Exception;
  41402. interface ExceptionInterface
  41403. {
  41404. public function getAdapter();
  41405. }
  41406. <?php
  41407. namespace Symfony\Component\Finder\Exception;
  41408. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41409. class OperationNotPermitedException extends AdapterFailureException
  41410. {
  41411. }
  41412. <?php
  41413. namespace Symfony\Component\Finder\Exception;
  41414. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41415. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41416. use Symfony\Component\Finder\Shell\Command;
  41417. class ShellCommandFailureException extends AdapterFailureException
  41418. {
  41419. private $command;
  41420. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  41421. {
  41422. $this->command = $command;
  41423. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  41424. }
  41425. public function getCommand()
  41426. {
  41427. return $this->command;
  41428. }
  41429. }
  41430. <?php
  41431. namespace Symfony\Component\Finder\Expression;
  41432. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41433. class Expression implements ValueInterface
  41434. {
  41435. const TYPE_REGEX = 1;
  41436. const TYPE_GLOB = 2;
  41437. private $value;
  41438. public static function create($expr)
  41439. {
  41440. return new self($expr);
  41441. }
  41442. public function __construct($expr)
  41443. {
  41444. try {
  41445. $this->value = Regex::create($expr);
  41446. } catch (\InvalidArgumentException $e) {
  41447. $this->value = new Glob($expr);
  41448. }
  41449. }
  41450. public function __toString()
  41451. {
  41452. return $this->render();
  41453. }
  41454. public function render()
  41455. {
  41456. return $this->value->render();
  41457. }
  41458. public function renderPattern()
  41459. {
  41460. return $this->value->renderPattern();
  41461. }
  41462. public function isCaseSensitive()
  41463. {
  41464. return $this->value->isCaseSensitive();
  41465. }
  41466. public function getType()
  41467. {
  41468. return $this->value->getType();
  41469. }
  41470. public function prepend($expr)
  41471. {
  41472. $this->value->prepend($expr);
  41473. return $this;
  41474. }
  41475. public function append($expr)
  41476. {
  41477. $this->value->append($expr);
  41478. return $this;
  41479. }
  41480. public function isRegex()
  41481. {
  41482. return self::TYPE_REGEX === $this->value->getType();
  41483. }
  41484. public function isGlob()
  41485. {
  41486. return self::TYPE_GLOB === $this->value->getType();
  41487. }
  41488. public function getGlob()
  41489. {
  41490. if (self::TYPE_GLOB !== $this->value->getType()) {
  41491. throw new \LogicException('Regex can\'t be transformed to glob.');
  41492. }
  41493. return $this->value;
  41494. }
  41495. public function getRegex()
  41496. {
  41497. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  41498. }
  41499. }
  41500. <?php
  41501. namespace Symfony\Component\Finder\Expression;
  41502. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41503. use Symfony\Component\Finder\Glob as FinderGlob;
  41504. class Glob implements ValueInterface
  41505. {
  41506. private $pattern;
  41507. public function __construct($pattern)
  41508. {
  41509. $this->pattern = $pattern;
  41510. }
  41511. public function render()
  41512. {
  41513. return $this->pattern;
  41514. }
  41515. public function renderPattern()
  41516. {
  41517. return $this->pattern;
  41518. }
  41519. public function getType()
  41520. {
  41521. return Expression::TYPE_GLOB;
  41522. }
  41523. public function isCaseSensitive()
  41524. {
  41525. return true;
  41526. }
  41527. public function prepend($expr)
  41528. {
  41529. $this->pattern = $expr.$this->pattern;
  41530. return $this;
  41531. }
  41532. public function append($expr)
  41533. {
  41534. $this->pattern .= $expr;
  41535. return $this;
  41536. }
  41537. public function isExpandable()
  41538. {
  41539. return false !== strpos($this->pattern, '{')
  41540. && false !== strpos($this->pattern, '}');
  41541. }
  41542. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  41543. {
  41544. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  41545. return new Regex($regex);
  41546. }
  41547. }
  41548. <?php
  41549. namespace Symfony\Component\Finder\Expression;
  41550. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41551. class Regex implements ValueInterface
  41552. {
  41553. const START_FLAG = '^';
  41554. const END_FLAG = '$';
  41555. const BOUNDARY = '~';
  41556. const JOKER = '.*';
  41557. const ESCAPING = '\\';
  41558. private $pattern;
  41559. private $options;
  41560. private $startFlag;
  41561. private $endFlag;
  41562. private $startJoker;
  41563. private $endJoker;
  41564. public static function create($expr)
  41565. {
  41566. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  41567. $start = substr($m[1], 0, 1);
  41568. $end = substr($m[1], -1);
  41569. if (
  41570. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  41571. || ('{' === $start && '}' === $end)
  41572. || ('(' === $start && ')' === $end)
  41573. ) {
  41574. return new self(substr($m[1], 1, -1), $m[2], $end);
  41575. }
  41576. }
  41577. throw new \InvalidArgumentException('Given expression is not a regex.');
  41578. }
  41579. public function __construct($pattern, $options = '', $delimiter = null)
  41580. {
  41581. if (null !== $delimiter) {
  41582. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  41583. }
  41584. $this->parsePattern($pattern);
  41585. $this->options = $options;
  41586. }
  41587. public function __toString()
  41588. {
  41589. return $this->render();
  41590. }
  41591. public function render()
  41592. {
  41593. return self::BOUNDARY
  41594. .$this->renderPattern()
  41595. .self::BOUNDARY
  41596. .$this->options;
  41597. }
  41598. public function renderPattern()
  41599. {
  41600. return ($this->startFlag ? self::START_FLAG : '')
  41601. .($this->startJoker ? self::JOKER : '')
  41602. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  41603. .($this->endJoker ? self::JOKER : '')
  41604. .($this->endFlag ? self::END_FLAG : '');
  41605. }
  41606. public function isCaseSensitive()
  41607. {
  41608. return !$this->hasOption('i');
  41609. }
  41610. public function getType()
  41611. {
  41612. return Expression::TYPE_REGEX;
  41613. }
  41614. public function prepend($expr)
  41615. {
  41616. $this->pattern = $expr.$this->pattern;
  41617. return $this;
  41618. }
  41619. public function append($expr)
  41620. {
  41621. $this->pattern .= $expr;
  41622. return $this;
  41623. }
  41624. public function hasOption($option)
  41625. {
  41626. return false !== strpos($this->options, $option);
  41627. }
  41628. public function addOption($option)
  41629. {
  41630. if (!$this->hasOption($option)) {
  41631. $this->options .= $option;
  41632. }
  41633. return $this;
  41634. }
  41635. public function removeOption($option)
  41636. {
  41637. $this->options = str_replace($option, '', $this->options);
  41638. return $this;
  41639. }
  41640. public function setStartFlag($startFlag)
  41641. {
  41642. $this->startFlag = $startFlag;
  41643. return $this;
  41644. }
  41645. public function hasStartFlag()
  41646. {
  41647. return $this->startFlag;
  41648. }
  41649. public function setEndFlag($endFlag)
  41650. {
  41651. $this->endFlag = (bool) $endFlag;
  41652. return $this;
  41653. }
  41654. public function hasEndFlag()
  41655. {
  41656. return $this->endFlag;
  41657. }
  41658. public function setStartJoker($startJoker)
  41659. {
  41660. $this->startJoker = $startJoker;
  41661. return $this;
  41662. }
  41663. public function hasStartJoker()
  41664. {
  41665. return $this->startJoker;
  41666. }
  41667. public function setEndJoker($endJoker)
  41668. {
  41669. $this->endJoker = (bool) $endJoker;
  41670. return $this;
  41671. }
  41672. public function hasEndJoker()
  41673. {
  41674. return $this->endJoker;
  41675. }
  41676. public function replaceJokers($replacement)
  41677. {
  41678. $replace = function ($subject) use ($replacement) {
  41679. $subject = $subject[0];
  41680. $replace = 0 === substr_count($subject, '\\') % 2;
  41681. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  41682. };
  41683. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  41684. return $this;
  41685. }
  41686. private function parsePattern($pattern)
  41687. {
  41688. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  41689. $pattern = substr($pattern, 1);
  41690. }
  41691. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  41692. $pattern = substr($pattern, 2);
  41693. }
  41694. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  41695. $pattern = substr($pattern, 0, -1);
  41696. }
  41697. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  41698. $pattern = substr($pattern, 0, -2);
  41699. }
  41700. $this->pattern = $pattern;
  41701. }
  41702. }
  41703. <?php
  41704. namespace Symfony\Component\Finder\Expression;
  41705. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41706. interface ValueInterface
  41707. {
  41708. public function render();
  41709. public function renderPattern();
  41710. public function isCaseSensitive();
  41711. public function getType();
  41712. public function prepend($expr);
  41713. public function append($expr);
  41714. }
  41715. <?php
  41716. namespace Symfony\Component\Finder;
  41717. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41718. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  41719. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  41720. use Symfony\Component\Finder\Adapter\PhpAdapter;
  41721. use Symfony\Component\Finder\Comparator\DateComparator;
  41722. use Symfony\Component\Finder\Comparator\NumberComparator;
  41723. use Symfony\Component\Finder\Exception\ExceptionInterface;
  41724. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  41725. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  41726. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  41727. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  41728. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  41729. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  41730. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  41731. use Symfony\Component\Finder\Iterator\SortableIterator;
  41732. class Finder implements \IteratorAggregate, \Countable
  41733. {
  41734. const IGNORE_VCS_FILES = 1;
  41735. const IGNORE_DOT_FILES = 2;
  41736. private $mode = 0;
  41737. private $names = array();
  41738. private $notNames = array();
  41739. private $exclude = array();
  41740. private $filters = array();
  41741. private $depths = array();
  41742. private $sizes = array();
  41743. private $followLinks = false;
  41744. private $sort = false;
  41745. private $ignore = 0;
  41746. private $dirs = array();
  41747. private $dates = array();
  41748. private $iterators = array();
  41749. private $contains = array();
  41750. private $notContains = array();
  41751. private $adapters = null;
  41752. private $paths = array();
  41753. private $notPaths = array();
  41754. private $ignoreUnreadableDirs = false;
  41755. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  41756. public function __construct()
  41757. {
  41758. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  41759. }
  41760. public static function create()
  41761. {
  41762. return new static();
  41763. }
  41764. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  41765. {
  41766. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41767. $this->initDefaultAdapters();
  41768. $this->adapters[$adapter->getName()] = array(
  41769. 'adapter' => $adapter,
  41770. 'priority' => $priority,
  41771. 'selected' => false,
  41772. );
  41773. return $this->sortAdapters();
  41774. }
  41775. public function useBestAdapter()
  41776. {
  41777. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41778. $this->initDefaultAdapters();
  41779. $this->resetAdapterSelection();
  41780. return $this->sortAdapters();
  41781. }
  41782. public function setAdapter($name)
  41783. {
  41784. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41785. $this->initDefaultAdapters();
  41786. if (!isset($this->adapters[$name])) {
  41787. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  41788. }
  41789. $this->resetAdapterSelection();
  41790. $this->adapters[$name]['selected'] = true;
  41791. return $this->sortAdapters();
  41792. }
  41793. public function removeAdapters()
  41794. {
  41795. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41796. $this->adapters = array();
  41797. return $this;
  41798. }
  41799. public function getAdapters()
  41800. {
  41801. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41802. $this->initDefaultAdapters();
  41803. return array_values(array_map(function (array $adapter) {
  41804. return $adapter['adapter'];
  41805. }, $this->adapters));
  41806. }
  41807. public function directories()
  41808. {
  41809. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  41810. return $this;
  41811. }
  41812. public function files()
  41813. {
  41814. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  41815. return $this;
  41816. }
  41817. public function depth($level)
  41818. {
  41819. $this->depths[] = new Comparator\NumberComparator($level);
  41820. return $this;
  41821. }
  41822. public function date($date)
  41823. {
  41824. $this->dates[] = new Comparator\DateComparator($date);
  41825. return $this;
  41826. }
  41827. public function name($pattern)
  41828. {
  41829. $this->names[] = $pattern;
  41830. return $this;
  41831. }
  41832. public function notName($pattern)
  41833. {
  41834. $this->notNames[] = $pattern;
  41835. return $this;
  41836. }
  41837. public function contains($pattern)
  41838. {
  41839. $this->contains[] = $pattern;
  41840. return $this;
  41841. }
  41842. public function notContains($pattern)
  41843. {
  41844. $this->notContains[] = $pattern;
  41845. return $this;
  41846. }
  41847. public function path($pattern)
  41848. {
  41849. $this->paths[] = $pattern;
  41850. return $this;
  41851. }
  41852. public function notPath($pattern)
  41853. {
  41854. $this->notPaths[] = $pattern;
  41855. return $this;
  41856. }
  41857. public function size($size)
  41858. {
  41859. $this->sizes[] = new Comparator\NumberComparator($size);
  41860. return $this;
  41861. }
  41862. public function exclude($dirs)
  41863. {
  41864. $this->exclude = array_merge($this->exclude, (array) $dirs);
  41865. return $this;
  41866. }
  41867. public function ignoreDotFiles($ignoreDotFiles)
  41868. {
  41869. if ($ignoreDotFiles) {
  41870. $this->ignore |= static::IGNORE_DOT_FILES;
  41871. } else {
  41872. $this->ignore &= ~static::IGNORE_DOT_FILES;
  41873. }
  41874. return $this;
  41875. }
  41876. public function ignoreVCS($ignoreVCS)
  41877. {
  41878. if ($ignoreVCS) {
  41879. $this->ignore |= static::IGNORE_VCS_FILES;
  41880. } else {
  41881. $this->ignore &= ~static::IGNORE_VCS_FILES;
  41882. }
  41883. return $this;
  41884. }
  41885. public static function addVCSPattern($pattern)
  41886. {
  41887. foreach ((array) $pattern as $p) {
  41888. self::$vcsPatterns[] = $p;
  41889. }
  41890. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  41891. }
  41892. public function sort(\Closure $closure)
  41893. {
  41894. $this->sort = $closure;
  41895. return $this;
  41896. }
  41897. public function sortByName()
  41898. {
  41899. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  41900. return $this;
  41901. }
  41902. public function sortByType()
  41903. {
  41904. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  41905. return $this;
  41906. }
  41907. public function sortByAccessedTime()
  41908. {
  41909. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41910. return $this;
  41911. }
  41912. public function sortByChangedTime()
  41913. {
  41914. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  41915. return $this;
  41916. }
  41917. public function sortByModifiedTime()
  41918. {
  41919. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  41920. return $this;
  41921. }
  41922. public function filter(\Closure $closure)
  41923. {
  41924. $this->filters[] = $closure;
  41925. return $this;
  41926. }
  41927. public function followLinks()
  41928. {
  41929. $this->followLinks = true;
  41930. return $this;
  41931. }
  41932. public function ignoreUnreadableDirs($ignore = true)
  41933. {
  41934. $this->ignoreUnreadableDirs = (bool) $ignore;
  41935. return $this;
  41936. }
  41937. public function in($dirs)
  41938. {
  41939. $resolvedDirs = array();
  41940. foreach ((array) $dirs as $dir) {
  41941. if (is_dir($dir)) {
  41942. $resolvedDirs[] = $this->normalizeDir($dir);
  41943. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  41944. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  41945. } else {
  41946. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  41947. }
  41948. }
  41949. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  41950. return $this;
  41951. }
  41952. public function getIterator()
  41953. {
  41954. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41955. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  41956. }
  41957. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41958. return $this->searchInDirectory($this->dirs[0]);
  41959. }
  41960. $iterator = new \AppendIterator();
  41961. foreach ($this->dirs as $dir) {
  41962. $iterator->append($this->searchInDirectory($dir));
  41963. }
  41964. foreach ($this->iterators as $it) {
  41965. $iterator->append($it);
  41966. }
  41967. return $iterator;
  41968. }
  41969. public function append($iterator)
  41970. {
  41971. if ($iterator instanceof \IteratorAggregate) {
  41972. $this->iterators[] = $iterator->getIterator();
  41973. } elseif ($iterator instanceof \Iterator) {
  41974. $this->iterators[] = $iterator;
  41975. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  41976. $it = new \ArrayIterator();
  41977. foreach ($iterator as $file) {
  41978. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  41979. }
  41980. $this->iterators[] = $it;
  41981. } else {
  41982. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  41983. }
  41984. return $this;
  41985. }
  41986. public function count()
  41987. {
  41988. return iterator_count($this->getIterator());
  41989. }
  41990. private function sortAdapters()
  41991. {
  41992. uasort($this->adapters, function (array $a, array $b) {
  41993. if ($a['selected'] || $b['selected']) {
  41994. return $a['selected'] ? -1 : 1;
  41995. }
  41996. return $a['priority'] > $b['priority'] ? -1 : 1;
  41997. });
  41998. return $this;
  41999. }
  42000. private function searchInDirectory($dir)
  42001. {
  42002. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  42003. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  42004. }
  42005. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  42006. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  42007. }
  42008. if ($this->adapters) {
  42009. foreach ($this->adapters as $adapter) {
  42010. if ($adapter['adapter']->isSupported()) {
  42011. try {
  42012. return $this
  42013. ->buildAdapter($adapter['adapter'])
  42014. ->searchInDirectory($dir);
  42015. } catch (ExceptionInterface $e) {
  42016. }
  42017. }
  42018. }
  42019. }
  42020. $minDepth = 0;
  42021. $maxDepth = PHP_INT_MAX;
  42022. foreach ($this->depths as $comparator) {
  42023. switch ($comparator->getOperator()) {
  42024. case '>':
  42025. $minDepth = $comparator->getTarget() + 1;
  42026. break;
  42027. case '>=':
  42028. $minDepth = $comparator->getTarget();
  42029. break;
  42030. case '<':
  42031. $maxDepth = $comparator->getTarget() - 1;
  42032. break;
  42033. case '<=':
  42034. $maxDepth = $comparator->getTarget();
  42035. break;
  42036. default:
  42037. $minDepth = $maxDepth = $comparator->getTarget();
  42038. }
  42039. }
  42040. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42041. if ($this->followLinks) {
  42042. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42043. }
  42044. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42045. if ($this->exclude) {
  42046. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42047. }
  42048. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42049. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  42050. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  42051. }
  42052. if ($this->mode) {
  42053. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42054. }
  42055. if ($this->names || $this->notNames) {
  42056. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42057. }
  42058. if ($this->contains || $this->notContains) {
  42059. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42060. }
  42061. if ($this->sizes) {
  42062. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42063. }
  42064. if ($this->dates) {
  42065. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42066. }
  42067. if ($this->filters) {
  42068. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42069. }
  42070. if ($this->paths || $this->notPaths) {
  42071. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42072. }
  42073. if ($this->sort) {
  42074. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42075. $iterator = $iteratorAggregate->getIterator();
  42076. }
  42077. return $iterator;
  42078. }
  42079. private function buildAdapter(AdapterInterface $adapter)
  42080. {
  42081. return $adapter
  42082. ->setFollowLinks($this->followLinks)
  42083. ->setDepths($this->depths)
  42084. ->setMode($this->mode)
  42085. ->setExclude($this->exclude)
  42086. ->setNames($this->names)
  42087. ->setNotNames($this->notNames)
  42088. ->setContains($this->contains)
  42089. ->setNotContains($this->notContains)
  42090. ->setSizes($this->sizes)
  42091. ->setDates($this->dates)
  42092. ->setFilters($this->filters)
  42093. ->setSort($this->sort)
  42094. ->setPath($this->paths)
  42095. ->setNotPath($this->notPaths)
  42096. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  42097. }
  42098. private function resetAdapterSelection()
  42099. {
  42100. $this->adapters = array_map(function (array $properties) {
  42101. $properties['selected'] = false;
  42102. return $properties;
  42103. }, $this->adapters);
  42104. }
  42105. private function initDefaultAdapters()
  42106. {
  42107. if (null === $this->adapters) {
  42108. $this->adapters = array();
  42109. $this
  42110. ->addAdapter(new GnuFindAdapter())
  42111. ->addAdapter(new BsdFindAdapter())
  42112. ->addAdapter(new PhpAdapter(), -50)
  42113. ->setAdapter('php')
  42114. ;
  42115. }
  42116. }
  42117. private function normalizeDir($dir)
  42118. {
  42119. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  42120. }
  42121. }
  42122. <?php
  42123. namespace Symfony\Component\Finder;
  42124. class Glob
  42125. {
  42126. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  42127. {
  42128. $firstByte = true;
  42129. $escaping = false;
  42130. $inCurlies = 0;
  42131. $regex = '';
  42132. $sizeGlob = \strlen($glob);
  42133. for ($i = 0; $i < $sizeGlob; ++$i) {
  42134. $car = $glob[$i];
  42135. if ($firstByte) {
  42136. if ($strictLeadingDot && '.' !== $car) {
  42137. $regex .= '(?=[^\.])';
  42138. }
  42139. $firstByte = false;
  42140. }
  42141. if ('/' === $car) {
  42142. $firstByte = true;
  42143. }
  42144. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  42145. $regex .= "\\$car";
  42146. } elseif ('*' === $car) {
  42147. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  42148. } elseif ('?' === $car) {
  42149. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  42150. } elseif ('{' === $car) {
  42151. $regex .= $escaping ? '\\{' : '(';
  42152. if (!$escaping) {
  42153. ++$inCurlies;
  42154. }
  42155. } elseif ('}' === $car && $inCurlies) {
  42156. $regex .= $escaping ? '}' : ')';
  42157. if (!$escaping) {
  42158. --$inCurlies;
  42159. }
  42160. } elseif (',' === $car && $inCurlies) {
  42161. $regex .= $escaping ? ',' : '|';
  42162. } elseif ('\\' === $car) {
  42163. if ($escaping) {
  42164. $regex .= '\\\\';
  42165. $escaping = false;
  42166. } else {
  42167. $escaping = true;
  42168. }
  42169. continue;
  42170. } else {
  42171. $regex .= $car;
  42172. }
  42173. $escaping = false;
  42174. }
  42175. return $delimiter.'^'.$regex.'$'.$delimiter;
  42176. }
  42177. }
  42178. <?php
  42179. namespace Symfony\Component\Finder\Iterator;
  42180. class CustomFilterIterator extends FilterIterator
  42181. {
  42182. private $filters = array();
  42183. public function __construct(\Iterator $iterator, array $filters)
  42184. {
  42185. foreach ($filters as $filter) {
  42186. if (!\is_callable($filter)) {
  42187. throw new \InvalidArgumentException('Invalid PHP callback.');
  42188. }
  42189. }
  42190. $this->filters = $filters;
  42191. parent::__construct($iterator);
  42192. }
  42193. public function accept()
  42194. {
  42195. $fileinfo = $this->current();
  42196. foreach ($this->filters as $filter) {
  42197. if (false === \call_user_func($filter, $fileinfo)) {
  42198. return false;
  42199. }
  42200. }
  42201. return true;
  42202. }
  42203. }
  42204. <?php
  42205. namespace Symfony\Component\Finder\Iterator;
  42206. use Symfony\Component\Finder\Comparator\DateComparator;
  42207. class DateRangeFilterIterator extends FilterIterator
  42208. {
  42209. private $comparators = array();
  42210. public function __construct(\Iterator $iterator, array $comparators)
  42211. {
  42212. $this->comparators = $comparators;
  42213. parent::__construct($iterator);
  42214. }
  42215. public function accept()
  42216. {
  42217. $fileinfo = $this->current();
  42218. if (!file_exists($fileinfo->getPathname())) {
  42219. return false;
  42220. }
  42221. $filedate = $fileinfo->getMTime();
  42222. foreach ($this->comparators as $compare) {
  42223. if (!$compare->test($filedate)) {
  42224. return false;
  42225. }
  42226. }
  42227. return true;
  42228. }
  42229. }
  42230. <?php
  42231. namespace Symfony\Component\Finder\Iterator;
  42232. class DepthRangeFilterIterator extends FilterIterator
  42233. {
  42234. private $minDepth = 0;
  42235. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  42236. {
  42237. $this->minDepth = $minDepth;
  42238. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  42239. parent::__construct($iterator);
  42240. }
  42241. public function accept()
  42242. {
  42243. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  42244. }
  42245. }
  42246. <?php
  42247. namespace Symfony\Component\Finder\Iterator;
  42248. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  42249. {
  42250. private $iterator;
  42251. private $isRecursive;
  42252. private $excludedDirs = array();
  42253. private $excludedPattern;
  42254. public function __construct(\Iterator $iterator, array $directories)
  42255. {
  42256. $this->iterator = $iterator;
  42257. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  42258. $patterns = array();
  42259. foreach ($directories as $directory) {
  42260. $directory = rtrim($directory, '/');
  42261. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  42262. $patterns[] = preg_quote($directory, '#');
  42263. } else {
  42264. $this->excludedDirs[$directory] = true;
  42265. }
  42266. }
  42267. if ($patterns) {
  42268. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  42269. }
  42270. parent::__construct($iterator);
  42271. }
  42272. public function accept()
  42273. {
  42274. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  42275. return false;
  42276. }
  42277. if ($this->excludedPattern) {
  42278. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  42279. $path = str_replace('\\', '/', $path);
  42280. return !preg_match($this->excludedPattern, $path);
  42281. }
  42282. return true;
  42283. }
  42284. public function hasChildren()
  42285. {
  42286. return $this->isRecursive && $this->iterator->hasChildren();
  42287. }
  42288. public function getChildren()
  42289. {
  42290. $children = new self($this->iterator->getChildren(), array());
  42291. $children->excludedDirs = $this->excludedDirs;
  42292. $children->excludedPattern = $this->excludedPattern;
  42293. return $children;
  42294. }
  42295. }
  42296. <?php
  42297. namespace Symfony\Component\Finder\Iterator;
  42298. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42299. use Symfony\Component\Finder\SplFileInfo;
  42300. class FilePathsIterator extends \ArrayIterator
  42301. {
  42302. private $baseDir;
  42303. private $baseDirLength;
  42304. private $subPath;
  42305. private $subPathname;
  42306. private $current;
  42307. public function __construct(array $paths, $baseDir)
  42308. {
  42309. $this->baseDir = $baseDir;
  42310. $this->baseDirLength = \strlen($baseDir);
  42311. parent::__construct($paths);
  42312. }
  42313. public function __call($name, array $arguments)
  42314. {
  42315. return \call_user_func_array(array($this->current(), $name), $arguments);
  42316. }
  42317. public function current()
  42318. {
  42319. return $this->current;
  42320. }
  42321. public function key()
  42322. {
  42323. return $this->current->getPathname();
  42324. }
  42325. public function next()
  42326. {
  42327. parent::next();
  42328. $this->buildProperties();
  42329. }
  42330. public function rewind()
  42331. {
  42332. parent::rewind();
  42333. $this->buildProperties();
  42334. }
  42335. public function getSubPath()
  42336. {
  42337. return $this->subPath;
  42338. }
  42339. public function getSubPathname()
  42340. {
  42341. return $this->subPathname;
  42342. }
  42343. private function buildProperties()
  42344. {
  42345. $absolutePath = parent::current();
  42346. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  42347. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  42348. $dir = \dirname($this->subPathname);
  42349. $this->subPath = '.' === $dir ? '' : $dir;
  42350. } else {
  42351. $this->subPath = $this->subPathname = '';
  42352. }
  42353. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  42354. }
  42355. }
  42356. <?php
  42357. namespace Symfony\Component\Finder\Iterator;
  42358. class FileTypeFilterIterator extends FilterIterator
  42359. {
  42360. const ONLY_FILES = 1;
  42361. const ONLY_DIRECTORIES = 2;
  42362. private $mode;
  42363. public function __construct(\Iterator $iterator, $mode)
  42364. {
  42365. $this->mode = $mode;
  42366. parent::__construct($iterator);
  42367. }
  42368. public function accept()
  42369. {
  42370. $fileinfo = $this->current();
  42371. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  42372. return false;
  42373. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  42374. return false;
  42375. }
  42376. return true;
  42377. }
  42378. }
  42379. <?php
  42380. namespace Symfony\Component\Finder\Iterator;
  42381. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  42382. {
  42383. public function accept()
  42384. {
  42385. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  42386. return true;
  42387. }
  42388. $fileinfo = $this->current();
  42389. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  42390. return false;
  42391. }
  42392. $content = $fileinfo->getContents();
  42393. if (!$content) {
  42394. return false;
  42395. }
  42396. return $this->isAccepted($content);
  42397. }
  42398. protected function toRegex($str)
  42399. {
  42400. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42401. }
  42402. }
  42403. <?php
  42404. namespace Symfony\Component\Finder\Iterator;
  42405. use Symfony\Component\Finder\Glob;
  42406. class FilenameFilterIterator extends MultiplePcreFilterIterator
  42407. {
  42408. public function accept()
  42409. {
  42410. return $this->isAccepted($this->current()->getFilename());
  42411. }
  42412. protected function toRegex($str)
  42413. {
  42414. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  42415. }
  42416. }
  42417. <?php
  42418. namespace Symfony\Component\Finder\Iterator;
  42419. abstract class FilterIterator extends \FilterIterator
  42420. {
  42421. public function rewind()
  42422. {
  42423. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  42424. parent::rewind();
  42425. return;
  42426. }
  42427. $iterator = $this;
  42428. while ($iterator instanceof \OuterIterator) {
  42429. $innerIterator = $iterator->getInnerIterator();
  42430. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  42431. if ($innerIterator->isRewindable()) {
  42432. $innerIterator->next();
  42433. $innerIterator->rewind();
  42434. }
  42435. } elseif ($innerIterator instanceof \FilesystemIterator) {
  42436. $innerIterator->next();
  42437. $innerIterator->rewind();
  42438. }
  42439. $iterator = $innerIterator;
  42440. }
  42441. parent::rewind();
  42442. }
  42443. }
  42444. <?php
  42445. namespace Symfony\Component\Finder\Iterator;
  42446. abstract class MultiplePcreFilterIterator extends FilterIterator
  42447. {
  42448. protected $matchRegexps = array();
  42449. protected $noMatchRegexps = array();
  42450. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  42451. {
  42452. foreach ($matchPatterns as $pattern) {
  42453. $this->matchRegexps[] = $this->toRegex($pattern);
  42454. }
  42455. foreach ($noMatchPatterns as $pattern) {
  42456. $this->noMatchRegexps[] = $this->toRegex($pattern);
  42457. }
  42458. parent::__construct($iterator);
  42459. }
  42460. protected function isAccepted($string)
  42461. {
  42462. foreach ($this->noMatchRegexps as $regex) {
  42463. if (preg_match($regex, $string)) {
  42464. return false;
  42465. }
  42466. }
  42467. if ($this->matchRegexps) {
  42468. foreach ($this->matchRegexps as $regex) {
  42469. if (preg_match($regex, $string)) {
  42470. return true;
  42471. }
  42472. }
  42473. return false;
  42474. }
  42475. return true;
  42476. }
  42477. protected function isRegex($str)
  42478. {
  42479. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  42480. $start = substr($m[1], 0, 1);
  42481. $end = substr($m[1], -1);
  42482. if ($start === $end) {
  42483. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  42484. }
  42485. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  42486. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  42487. return true;
  42488. }
  42489. }
  42490. }
  42491. return false;
  42492. }
  42493. abstract protected function toRegex($str);
  42494. }
  42495. <?php
  42496. namespace Symfony\Component\Finder\Iterator;
  42497. class PathFilterIterator extends MultiplePcreFilterIterator
  42498. {
  42499. public function accept()
  42500. {
  42501. $filename = $this->current()->getRelativePathname();
  42502. if ('\\' === \DIRECTORY_SEPARATOR) {
  42503. $filename = str_replace('\\', '/', $filename);
  42504. }
  42505. return $this->isAccepted($filename);
  42506. }
  42507. protected function toRegex($str)
  42508. {
  42509. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42510. }
  42511. }
  42512. <?php
  42513. namespace Symfony\Component\Finder\Iterator;
  42514. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42515. use Symfony\Component\Finder\SplFileInfo;
  42516. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  42517. {
  42518. private $ignoreUnreadableDirs;
  42519. private $rewindable;
  42520. private $rootPath;
  42521. private $subPath;
  42522. private $directorySeparator = '/';
  42523. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  42524. {
  42525. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  42526. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  42527. }
  42528. parent::__construct($path, $flags);
  42529. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  42530. $this->rootPath = (string) $path;
  42531. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  42532. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  42533. }
  42534. }
  42535. public function current()
  42536. {
  42537. if (null === $subPathname = $this->subPath) {
  42538. $subPathname = $this->subPath = (string) $this->getSubPath();
  42539. }
  42540. if ('' !== $subPathname) {
  42541. $subPathname .= $this->directorySeparator;
  42542. }
  42543. $subPathname .= $this->getFilename();
  42544. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  42545. }
  42546. public function getChildren()
  42547. {
  42548. try {
  42549. $children = parent::getChildren();
  42550. if ($children instanceof self) {
  42551. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  42552. $children->rewindable = &$this->rewindable;
  42553. $children->rootPath = $this->rootPath;
  42554. }
  42555. return $children;
  42556. } catch (\UnexpectedValueException $e) {
  42557. if ($this->ignoreUnreadableDirs) {
  42558. return new \RecursiveArrayIterator(array());
  42559. } else {
  42560. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  42561. }
  42562. }
  42563. }
  42564. public function rewind()
  42565. {
  42566. if (false === $this->isRewindable()) {
  42567. return;
  42568. }
  42569. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  42570. parent::next();
  42571. }
  42572. parent::rewind();
  42573. }
  42574. public function isRewindable()
  42575. {
  42576. if (null !== $this->rewindable) {
  42577. return $this->rewindable;
  42578. }
  42579. if ('' === $this->getPath()) {
  42580. return $this->rewindable = false;
  42581. }
  42582. if (false !== $stream = @opendir($this->getPath())) {
  42583. $infos = stream_get_meta_data($stream);
  42584. closedir($stream);
  42585. if ($infos['seekable']) {
  42586. return $this->rewindable = true;
  42587. }
  42588. }
  42589. return $this->rewindable = false;
  42590. }
  42591. }
  42592. <?php
  42593. namespace Symfony\Component\Finder\Iterator;
  42594. use Symfony\Component\Finder\Comparator\NumberComparator;
  42595. class SizeRangeFilterIterator extends FilterIterator
  42596. {
  42597. private $comparators = array();
  42598. public function __construct(\Iterator $iterator, array $comparators)
  42599. {
  42600. $this->comparators = $comparators;
  42601. parent::__construct($iterator);
  42602. }
  42603. public function accept()
  42604. {
  42605. $fileinfo = $this->current();
  42606. if (!$fileinfo->isFile()) {
  42607. return true;
  42608. }
  42609. $filesize = $fileinfo->getSize();
  42610. foreach ($this->comparators as $compare) {
  42611. if (!$compare->test($filesize)) {
  42612. return false;
  42613. }
  42614. }
  42615. return true;
  42616. }
  42617. }
  42618. <?php
  42619. namespace Symfony\Component\Finder\Iterator;
  42620. class SortableIterator implements \IteratorAggregate
  42621. {
  42622. const SORT_BY_NAME = 1;
  42623. const SORT_BY_TYPE = 2;
  42624. const SORT_BY_ACCESSED_TIME = 3;
  42625. const SORT_BY_CHANGED_TIME = 4;
  42626. const SORT_BY_MODIFIED_TIME = 5;
  42627. private $iterator;
  42628. private $sort;
  42629. public function __construct(\Traversable $iterator, $sort)
  42630. {
  42631. $this->iterator = $iterator;
  42632. if (self::SORT_BY_NAME === $sort) {
  42633. $this->sort = function ($a, $b) {
  42634. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42635. };
  42636. } elseif (self::SORT_BY_TYPE === $sort) {
  42637. $this->sort = function ($a, $b) {
  42638. if ($a->isDir() && $b->isFile()) {
  42639. return -1;
  42640. } elseif ($a->isFile() && $b->isDir()) {
  42641. return 1;
  42642. }
  42643. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42644. };
  42645. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  42646. $this->sort = function ($a, $b) {
  42647. return $a->getATime() - $b->getATime();
  42648. };
  42649. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  42650. $this->sort = function ($a, $b) {
  42651. return $a->getCTime() - $b->getCTime();
  42652. };
  42653. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  42654. $this->sort = function ($a, $b) {
  42655. return $a->getMTime() - $b->getMTime();
  42656. };
  42657. } elseif (\is_callable($sort)) {
  42658. $this->sort = $sort;
  42659. } else {
  42660. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  42661. }
  42662. }
  42663. public function getIterator()
  42664. {
  42665. $array = iterator_to_array($this->iterator, true);
  42666. uasort($array, $this->sort);
  42667. return new \ArrayIterator($array);
  42668. }
  42669. }
  42670. Copyright (c) 2004-2018 Fabien Potencier
  42671. Permission is hereby granted, free of charge, to any person obtaining a copy
  42672. of this software and associated documentation files (the "Software"), to deal
  42673. in the Software without restriction, including without limitation the rights
  42674. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42675. copies of the Software, and to permit persons to whom the Software is furnished
  42676. to do so, subject to the following conditions:
  42677. The above copyright notice and this permission notice shall be included in all
  42678. copies or substantial portions of the Software.
  42679. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42680. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42681. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42682. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42683. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42684. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42685. THE SOFTWARE.
  42686. <?php
  42687. namespace Symfony\Component\Finder\Shell;
  42688. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42689. class Command
  42690. {
  42691. private $parent;
  42692. private $bits = array();
  42693. private $labels = array();
  42694. private $errorHandler;
  42695. public function __construct(Command $parent = null)
  42696. {
  42697. $this->parent = $parent;
  42698. }
  42699. public function __toString()
  42700. {
  42701. return $this->join();
  42702. }
  42703. public static function create(Command $parent = null)
  42704. {
  42705. return new self($parent);
  42706. }
  42707. public static function escape($input)
  42708. {
  42709. return escapeshellcmd($input);
  42710. }
  42711. public static function quote($input)
  42712. {
  42713. return escapeshellarg($input);
  42714. }
  42715. public function add($bit)
  42716. {
  42717. $this->bits[] = $bit;
  42718. return $this;
  42719. }
  42720. public function top($bit)
  42721. {
  42722. array_unshift($this->bits, $bit);
  42723. foreach ($this->labels as $label => $index) {
  42724. ++$this->labels[$label];
  42725. }
  42726. return $this;
  42727. }
  42728. public function arg($arg)
  42729. {
  42730. $this->bits[] = self::quote($arg);
  42731. return $this;
  42732. }
  42733. public function cmd($esc)
  42734. {
  42735. $this->bits[] = self::escape($esc);
  42736. return $this;
  42737. }
  42738. public function ins($label)
  42739. {
  42740. if (isset($this->labels[$label])) {
  42741. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  42742. }
  42743. $this->bits[] = self::create($this);
  42744. $this->labels[$label] = \count($this->bits) - 1;
  42745. return $this->bits[$this->labels[$label]];
  42746. }
  42747. public function get($label)
  42748. {
  42749. if (!isset($this->labels[$label])) {
  42750. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  42751. }
  42752. return $this->bits[$this->labels[$label]];
  42753. }
  42754. public function end()
  42755. {
  42756. if (null === $this->parent) {
  42757. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  42758. }
  42759. return $this->parent;
  42760. }
  42761. public function length()
  42762. {
  42763. return \count($this->bits);
  42764. }
  42765. public function setErrorHandler(\Closure $errorHandler)
  42766. {
  42767. $this->errorHandler = $errorHandler;
  42768. return $this;
  42769. }
  42770. public function getErrorHandler()
  42771. {
  42772. return $this->errorHandler;
  42773. }
  42774. public function execute()
  42775. {
  42776. if (null === $errorHandler = $this->errorHandler) {
  42777. exec($this->join(), $output);
  42778. } else {
  42779. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  42780. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  42781. if ($error = stream_get_contents($pipes[2])) {
  42782. $errorHandler($error);
  42783. }
  42784. proc_close($process);
  42785. }
  42786. return $output ?: array();
  42787. }
  42788. public function join()
  42789. {
  42790. return implode(' ', array_filter(
  42791. array_map(function ($bit) {
  42792. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  42793. }, $this->bits),
  42794. function ($bit) { return null !== $bit; }
  42795. ));
  42796. }
  42797. public function addAtIndex($bit, $index)
  42798. {
  42799. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  42800. return $this;
  42801. }
  42802. }
  42803. <?php
  42804. namespace Symfony\Component\Finder\Shell;
  42805. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42806. class Shell
  42807. {
  42808. const TYPE_UNIX = 1;
  42809. const TYPE_DARWIN = 2;
  42810. const TYPE_CYGWIN = 3;
  42811. const TYPE_WINDOWS = 4;
  42812. const TYPE_BSD = 5;
  42813. private $type;
  42814. public function getType()
  42815. {
  42816. if (null === $this->type) {
  42817. $this->type = $this->guessType();
  42818. }
  42819. return $this->type;
  42820. }
  42821. public function testCommand($command)
  42822. {
  42823. if (!\function_exists('exec')) {
  42824. return false;
  42825. }
  42826. $testCommand = 'which ';
  42827. if (self::TYPE_WINDOWS === $this->type) {
  42828. $testCommand = 'where ';
  42829. }
  42830. $command = escapeshellcmd($command);
  42831. exec($testCommand.$command, $output, $code);
  42832. return 0 === $code && \count($output) > 0;
  42833. }
  42834. private function guessType()
  42835. {
  42836. $os = strtolower(PHP_OS);
  42837. if (false !== strpos($os, 'cygwin')) {
  42838. return self::TYPE_CYGWIN;
  42839. }
  42840. if (false !== strpos($os, 'darwin')) {
  42841. return self::TYPE_DARWIN;
  42842. }
  42843. if (false !== strpos($os, 'bsd')) {
  42844. return self::TYPE_BSD;
  42845. }
  42846. if (0 === strpos($os, 'win')) {
  42847. return self::TYPE_WINDOWS;
  42848. }
  42849. return self::TYPE_UNIX;
  42850. }
  42851. }
  42852. <?php
  42853. namespace Symfony\Component\Finder;
  42854. class SplFileInfo extends \SplFileInfo
  42855. {
  42856. private $relativePath;
  42857. private $relativePathname;
  42858. public function __construct($file, $relativePath, $relativePathname)
  42859. {
  42860. parent::__construct($file);
  42861. $this->relativePath = $relativePath;
  42862. $this->relativePathname = $relativePathname;
  42863. }
  42864. public function getRelativePath()
  42865. {
  42866. return $this->relativePath;
  42867. }
  42868. public function getRelativePathname()
  42869. {
  42870. return $this->relativePathname;
  42871. }
  42872. public function getContents()
  42873. {
  42874. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  42875. $content = file_get_contents($this->getPathname());
  42876. restore_error_handler();
  42877. if (false === $content) {
  42878. throw new \RuntimeException($error);
  42879. }
  42880. return $content;
  42881. }
  42882. }
  42883. <?php
  42884. namespace Symfony\Polyfill\Ctype;
  42885. final class Ctype
  42886. {
  42887. public static function ctype_alnum($text)
  42888. {
  42889. $text = self::convert_int_to_char_for_ctype($text);
  42890. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  42891. }
  42892. public static function ctype_alpha($text)
  42893. {
  42894. $text = self::convert_int_to_char_for_ctype($text);
  42895. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  42896. }
  42897. public static function ctype_cntrl($text)
  42898. {
  42899. $text = self::convert_int_to_char_for_ctype($text);
  42900. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  42901. }
  42902. public static function ctype_digit($text)
  42903. {
  42904. $text = self::convert_int_to_char_for_ctype($text);
  42905. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42906. }
  42907. public static function ctype_graph($text)
  42908. {
  42909. $text = self::convert_int_to_char_for_ctype($text);
  42910. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42911. }
  42912. public static function ctype_lower($text)
  42913. {
  42914. $text = self::convert_int_to_char_for_ctype($text);
  42915. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  42916. }
  42917. public static function ctype_print($text)
  42918. {
  42919. $text = self::convert_int_to_char_for_ctype($text);
  42920. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  42921. }
  42922. public static function ctype_punct($text)
  42923. {
  42924. $text = self::convert_int_to_char_for_ctype($text);
  42925. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  42926. }
  42927. public static function ctype_space($text)
  42928. {
  42929. $text = self::convert_int_to_char_for_ctype($text);
  42930. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  42931. }
  42932. public static function ctype_upper($text)
  42933. {
  42934. $text = self::convert_int_to_char_for_ctype($text);
  42935. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  42936. }
  42937. public static function ctype_xdigit($text)
  42938. {
  42939. $text = self::convert_int_to_char_for_ctype($text);
  42940. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  42941. }
  42942. private static function convert_int_to_char_for_ctype($int)
  42943. {
  42944. if (!\is_int($int)) {
  42945. return $int;
  42946. }
  42947. if ($int < -128 || $int > 255) {
  42948. return (string) $int;
  42949. }
  42950. if ($int < 0) {
  42951. $int += 256;
  42952. }
  42953. return \chr($int);
  42954. }
  42955. }
  42956. Copyright (c) 2018-2019 Fabien Potencier
  42957. Permission is hereby granted, free of charge, to any person obtaining a copy
  42958. of this software and associated documentation files (the "Software"), to deal
  42959. in the Software without restriction, including without limitation the rights
  42960. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42961. copies of the Software, and to permit persons to whom the Software is furnished
  42962. to do so, subject to the following conditions:
  42963. The above copyright notice and this permission notice shall be included in all
  42964. copies or substantial portions of the Software.
  42965. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42966. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42967. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42968. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42969. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42970. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42971. THE SOFTWARE.
  42972. <?php
  42973. use Symfony\Polyfill\Ctype as p;
  42974. if (!function_exists('ctype_alnum')) {
  42975. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  42976. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  42977. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  42978. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  42979. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  42980. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  42981. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  42982. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  42983. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  42984. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  42985. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  42986. }
  42987. Copyright (c) 2015-2019 Fabien Potencier
  42988. Permission is hereby granted, free of charge, to any person obtaining a copy
  42989. of this software and associated documentation files (the "Software"), to deal
  42990. in the Software without restriction, including without limitation the rights
  42991. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42992. copies of the Software, and to permit persons to whom the Software is furnished
  42993. to do so, subject to the following conditions:
  42994. The above copyright notice and this permission notice shall be included in all
  42995. copies or substantial portions of the Software.
  42996. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42997. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42998. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42999. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43000. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43001. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43002. THE SOFTWARE.
  43003. <?php
  43004. namespace Symfony\Polyfill\Mbstring;
  43005. final class Mbstring
  43006. {
  43007. const MB_CASE_FOLD = PHP_INT_MAX;
  43008. private static $encodingList = array('ASCII', 'UTF-8');
  43009. private static $language = 'neutral';
  43010. private static $internalEncoding = 'UTF-8';
  43011. private static $caseFold = array(
  43012. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  43013. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  43014. );
  43015. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  43016. {
  43017. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  43018. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  43019. } else {
  43020. $fromEncoding = self::getEncoding($fromEncoding);
  43021. }
  43022. $toEncoding = self::getEncoding($toEncoding);
  43023. if ('BASE64' === $fromEncoding) {
  43024. $s = base64_decode($s);
  43025. $fromEncoding = $toEncoding;
  43026. }
  43027. if ('BASE64' === $toEncoding) {
  43028. return base64_encode($s);
  43029. }
  43030. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  43031. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  43032. $fromEncoding = 'Windows-1252';
  43033. }
  43034. if ('UTF-8' !== $fromEncoding) {
  43035. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  43036. }
  43037. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  43038. }
  43039. if ('HTML-ENTITIES' === $fromEncoding) {
  43040. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  43041. $fromEncoding = 'UTF-8';
  43042. }
  43043. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  43044. }
  43045. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  43046. {
  43047. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  43048. $ok = true;
  43049. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  43050. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  43051. $ok = false;
  43052. }
  43053. });
  43054. return $ok ? $fromEncoding : false;
  43055. }
  43056. public static function mb_decode_mimeheader($s)
  43057. {
  43058. return iconv_mime_decode($s, 2, self::$internalEncoding);
  43059. }
  43060. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  43061. {
  43062. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  43063. }
  43064. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  43065. {
  43066. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43067. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43068. return null;
  43069. }
  43070. if (!\is_array($convmap) || !$convmap) {
  43071. return false;
  43072. }
  43073. if (null !== $encoding && !\is_scalar($encoding)) {
  43074. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43075. return '';
  43076. }
  43077. $s = (string) $s;
  43078. if ('' === $s) {
  43079. return '';
  43080. }
  43081. $encoding = self::getEncoding($encoding);
  43082. if ('UTF-8' === $encoding) {
  43083. $encoding = null;
  43084. if (!preg_match('//u', $s)) {
  43085. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43086. }
  43087. } else {
  43088. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43089. }
  43090. $cnt = floor(\count($convmap) / 4) * 4;
  43091. for ($i = 0; $i < $cnt; $i += 4) {
  43092. $convmap[$i] += $convmap[$i + 2];
  43093. $convmap[$i + 1] += $convmap[$i + 2];
  43094. }
  43095. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  43096. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  43097. for ($i = 0; $i < $cnt; $i += 4) {
  43098. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  43099. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  43100. }
  43101. }
  43102. return $m[0];
  43103. }, $s);
  43104. if (null === $encoding) {
  43105. return $s;
  43106. }
  43107. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43108. }
  43109. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  43110. {
  43111. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43112. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43113. return null;
  43114. }
  43115. if (!\is_array($convmap) || !$convmap) {
  43116. return false;
  43117. }
  43118. if (null !== $encoding && !\is_scalar($encoding)) {
  43119. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43120. return null;
  43121. }
  43122. if (null !== $is_hex && !\is_scalar($is_hex)) {
  43123. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  43124. return null;
  43125. }
  43126. $s = (string) $s;
  43127. if ('' === $s) {
  43128. return '';
  43129. }
  43130. $encoding = self::getEncoding($encoding);
  43131. if ('UTF-8' === $encoding) {
  43132. $encoding = null;
  43133. if (!preg_match('//u', $s)) {
  43134. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43135. }
  43136. } else {
  43137. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43138. }
  43139. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43140. $cnt = floor(\count($convmap) / 4) * 4;
  43141. $i = 0;
  43142. $len = \strlen($s);
  43143. $result = '';
  43144. while ($i < $len) {
  43145. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43146. $uchr = substr($s, $i, $ulen);
  43147. $i += $ulen;
  43148. $c = self::mb_ord($uchr);
  43149. for ($j = 0; $j < $cnt; $j += 4) {
  43150. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  43151. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  43152. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  43153. continue 2;
  43154. }
  43155. }
  43156. $result .= $uchr;
  43157. }
  43158. if (null === $encoding) {
  43159. return $result;
  43160. }
  43161. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  43162. }
  43163. public static function mb_convert_case($s, $mode, $encoding = null)
  43164. {
  43165. $s = (string) $s;
  43166. if ('' === $s) {
  43167. return '';
  43168. }
  43169. $encoding = self::getEncoding($encoding);
  43170. if ('UTF-8' === $encoding) {
  43171. $encoding = null;
  43172. if (!preg_match('//u', $s)) {
  43173. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43174. }
  43175. } else {
  43176. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43177. }
  43178. if (MB_CASE_TITLE == $mode) {
  43179. static $titleRegexp = null;
  43180. if (null === $titleRegexp) {
  43181. $titleRegexp = self::getData('titleCaseRegexp');
  43182. }
  43183. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  43184. } else {
  43185. if (MB_CASE_UPPER == $mode) {
  43186. static $upper = null;
  43187. if (null === $upper) {
  43188. $upper = self::getData('upperCase');
  43189. }
  43190. $map = $upper;
  43191. } else {
  43192. if (self::MB_CASE_FOLD === $mode) {
  43193. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  43194. }
  43195. static $lower = null;
  43196. if (null === $lower) {
  43197. $lower = self::getData('lowerCase');
  43198. }
  43199. $map = $lower;
  43200. }
  43201. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43202. $i = 0;
  43203. $len = \strlen($s);
  43204. while ($i < $len) {
  43205. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43206. $uchr = substr($s, $i, $ulen);
  43207. $i += $ulen;
  43208. if (isset($map[$uchr])) {
  43209. $uchr = $map[$uchr];
  43210. $nlen = \strlen($uchr);
  43211. if ($nlen == $ulen) {
  43212. $nlen = $i;
  43213. do {
  43214. $s[--$nlen] = $uchr[--$ulen];
  43215. } while ($ulen);
  43216. } else {
  43217. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  43218. $len += $nlen - $ulen;
  43219. $i += $nlen - $ulen;
  43220. }
  43221. }
  43222. }
  43223. }
  43224. if (null === $encoding) {
  43225. return $s;
  43226. }
  43227. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43228. }
  43229. public static function mb_internal_encoding($encoding = null)
  43230. {
  43231. if (null === $encoding) {
  43232. return self::$internalEncoding;
  43233. }
  43234. $encoding = self::getEncoding($encoding);
  43235. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  43236. self::$internalEncoding = $encoding;
  43237. return true;
  43238. }
  43239. return false;
  43240. }
  43241. public static function mb_language($lang = null)
  43242. {
  43243. if (null === $lang) {
  43244. return self::$language;
  43245. }
  43246. switch ($lang = strtolower($lang)) {
  43247. case 'uni':
  43248. case 'neutral':
  43249. self::$language = $lang;
  43250. return true;
  43251. }
  43252. return false;
  43253. }
  43254. public static function mb_list_encodings()
  43255. {
  43256. return array('UTF-8');
  43257. }
  43258. public static function mb_encoding_aliases($encoding)
  43259. {
  43260. switch (strtoupper($encoding)) {
  43261. case 'UTF8':
  43262. case 'UTF-8':
  43263. return array('utf8');
  43264. }
  43265. return false;
  43266. }
  43267. public static function mb_check_encoding($var = null, $encoding = null)
  43268. {
  43269. if (null === $encoding) {
  43270. if (null === $var) {
  43271. return false;
  43272. }
  43273. $encoding = self::$internalEncoding;
  43274. }
  43275. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  43276. }
  43277. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  43278. {
  43279. if (null === $encodingList) {
  43280. $encodingList = self::$encodingList;
  43281. } else {
  43282. if (!\is_array($encodingList)) {
  43283. $encodingList = array_map('trim', explode(',', $encodingList));
  43284. }
  43285. $encodingList = array_map('strtoupper', $encodingList);
  43286. }
  43287. foreach ($encodingList as $enc) {
  43288. switch ($enc) {
  43289. case 'ASCII':
  43290. if (!preg_match('/[\x80-\xFF]/', $str)) {
  43291. return $enc;
  43292. }
  43293. break;
  43294. case 'UTF8':
  43295. case 'UTF-8':
  43296. if (preg_match('//u', $str)) {
  43297. return 'UTF-8';
  43298. }
  43299. break;
  43300. default:
  43301. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  43302. return $enc;
  43303. }
  43304. }
  43305. }
  43306. return false;
  43307. }
  43308. public static function mb_detect_order($encodingList = null)
  43309. {
  43310. if (null === $encodingList) {
  43311. return self::$encodingList;
  43312. }
  43313. if (!\is_array($encodingList)) {
  43314. $encodingList = array_map('trim', explode(',', $encodingList));
  43315. }
  43316. $encodingList = array_map('strtoupper', $encodingList);
  43317. foreach ($encodingList as $enc) {
  43318. switch ($enc) {
  43319. default:
  43320. if (strncmp($enc, 'ISO-8859-', 9)) {
  43321. return false;
  43322. }
  43323. case 'ASCII':
  43324. case 'UTF8':
  43325. case 'UTF-8':
  43326. }
  43327. }
  43328. self::$encodingList = $encodingList;
  43329. return true;
  43330. }
  43331. public static function mb_strlen($s, $encoding = null)
  43332. {
  43333. $encoding = self::getEncoding($encoding);
  43334. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43335. return \strlen($s);
  43336. }
  43337. return @iconv_strlen($s, $encoding);
  43338. }
  43339. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  43340. {
  43341. $encoding = self::getEncoding($encoding);
  43342. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43343. return strpos($haystack, $needle, $offset);
  43344. }
  43345. $needle = (string) $needle;
  43346. if ('' === $needle) {
  43347. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  43348. return false;
  43349. }
  43350. return iconv_strpos($haystack, $needle, $offset, $encoding);
  43351. }
  43352. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  43353. {
  43354. $encoding = self::getEncoding($encoding);
  43355. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43356. return strrpos($haystack, $needle, $offset);
  43357. }
  43358. if ($offset != (int) $offset) {
  43359. $offset = 0;
  43360. } elseif ($offset = (int) $offset) {
  43361. if ($offset < 0) {
  43362. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  43363. $offset = 0;
  43364. } else {
  43365. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  43366. }
  43367. }
  43368. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43369. return false !== $pos ? $offset + $pos : false;
  43370. }
  43371. public static function mb_strtolower($s, $encoding = null)
  43372. {
  43373. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  43374. }
  43375. public static function mb_strtoupper($s, $encoding = null)
  43376. {
  43377. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  43378. }
  43379. public static function mb_substitute_character($c = null)
  43380. {
  43381. if (0 === strcasecmp($c, 'none')) {
  43382. return true;
  43383. }
  43384. return null !== $c ? false : 'none';
  43385. }
  43386. public static function mb_substr($s, $start, $length = null, $encoding = null)
  43387. {
  43388. $encoding = self::getEncoding($encoding);
  43389. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43390. return substr($s, $start, null === $length ? 2147483647 : $length);
  43391. }
  43392. if ($start < 0) {
  43393. $start = iconv_strlen($s, $encoding) + $start;
  43394. if ($start < 0) {
  43395. $start = 0;
  43396. }
  43397. }
  43398. if (null === $length) {
  43399. $length = 2147483647;
  43400. } elseif ($length < 0) {
  43401. $length = iconv_strlen($s, $encoding) + $length - $start;
  43402. if ($length < 0) {
  43403. return '';
  43404. }
  43405. }
  43406. return (string) iconv_substr($s, $start, $length, $encoding);
  43407. }
  43408. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  43409. {
  43410. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43411. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43412. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  43413. }
  43414. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  43415. {
  43416. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  43417. return self::getSubpart($pos, $part, $haystack, $encoding);
  43418. }
  43419. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  43420. {
  43421. $encoding = self::getEncoding($encoding);
  43422. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43423. return strrchr($haystack, $needle, $part);
  43424. }
  43425. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43426. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43427. return self::getSubpart($pos, $part, $haystack, $encoding);
  43428. }
  43429. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  43430. {
  43431. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43432. $pos = self::mb_strripos($haystack, $needle, $encoding);
  43433. return self::getSubpart($pos, $part, $haystack, $encoding);
  43434. }
  43435. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  43436. {
  43437. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43438. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43439. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  43440. }
  43441. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  43442. {
  43443. $pos = strpos($haystack, $needle);
  43444. if (false === $pos) {
  43445. return false;
  43446. }
  43447. if ($part) {
  43448. return substr($haystack, 0, $pos);
  43449. }
  43450. return substr($haystack, $pos);
  43451. }
  43452. public static function mb_get_info($type = 'all')
  43453. {
  43454. $info = array(
  43455. 'internal_encoding' => self::$internalEncoding,
  43456. 'http_output' => 'pass',
  43457. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  43458. 'func_overload' => 0,
  43459. 'func_overload_list' => 'no overload',
  43460. 'mail_charset' => 'UTF-8',
  43461. 'mail_header_encoding' => 'BASE64',
  43462. 'mail_body_encoding' => 'BASE64',
  43463. 'illegal_chars' => 0,
  43464. 'encoding_translation' => 'Off',
  43465. 'language' => self::$language,
  43466. 'detect_order' => self::$encodingList,
  43467. 'substitute_character' => 'none',
  43468. 'strict_detection' => 'Off',
  43469. );
  43470. if ('all' === $type) {
  43471. return $info;
  43472. }
  43473. if (isset($info[$type])) {
  43474. return $info[$type];
  43475. }
  43476. return false;
  43477. }
  43478. public static function mb_http_input($type = '')
  43479. {
  43480. return false;
  43481. }
  43482. public static function mb_http_output($encoding = null)
  43483. {
  43484. return null !== $encoding ? 'pass' === $encoding : 'pass';
  43485. }
  43486. public static function mb_strwidth($s, $encoding = null)
  43487. {
  43488. $encoding = self::getEncoding($encoding);
  43489. if ('UTF-8' !== $encoding) {
  43490. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43491. }
  43492. $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);
  43493. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  43494. }
  43495. public static function mb_substr_count($haystack, $needle, $encoding = null)
  43496. {
  43497. return substr_count($haystack, $needle);
  43498. }
  43499. public static function mb_output_handler($contents, $status)
  43500. {
  43501. return $contents;
  43502. }
  43503. public static function mb_chr($code, $encoding = null)
  43504. {
  43505. if (0x80 > $code %= 0x200000) {
  43506. $s = \chr($code);
  43507. } elseif (0x800 > $code) {
  43508. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  43509. } elseif (0x10000 > $code) {
  43510. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43511. } else {
  43512. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43513. }
  43514. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43515. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  43516. }
  43517. return $s;
  43518. }
  43519. public static function mb_ord($s, $encoding = null)
  43520. {
  43521. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43522. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  43523. }
  43524. if (1 === \strlen($s)) {
  43525. return \ord($s);
  43526. }
  43527. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  43528. if (0xF0 <= $code) {
  43529. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  43530. }
  43531. if (0xE0 <= $code) {
  43532. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  43533. }
  43534. if (0xC0 <= $code) {
  43535. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  43536. }
  43537. return $code;
  43538. }
  43539. private static function getSubpart($pos, $part, $haystack, $encoding)
  43540. {
  43541. if (false === $pos) {
  43542. return false;
  43543. }
  43544. if ($part) {
  43545. return self::mb_substr($haystack, 0, $pos, $encoding);
  43546. }
  43547. return self::mb_substr($haystack, $pos, null, $encoding);
  43548. }
  43549. private static function html_encoding_callback(array $m)
  43550. {
  43551. $i = 1;
  43552. $entities = '';
  43553. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  43554. while (isset($m[$i])) {
  43555. if (0x80 > $m[$i]) {
  43556. $entities .= \chr($m[$i++]);
  43557. continue;
  43558. }
  43559. if (0xF0 <= $m[$i]) {
  43560. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43561. } elseif (0xE0 <= $m[$i]) {
  43562. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43563. } else {
  43564. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  43565. }
  43566. $entities .= '&#'.$c.';';
  43567. }
  43568. return $entities;
  43569. }
  43570. private static function title_case(array $s)
  43571. {
  43572. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  43573. }
  43574. private static function getData($file)
  43575. {
  43576. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  43577. return require $file;
  43578. }
  43579. return false;
  43580. }
  43581. private static function getEncoding($encoding)
  43582. {
  43583. if (null === $encoding) {
  43584. return self::$internalEncoding;
  43585. }
  43586. $encoding = strtoupper($encoding);
  43587. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  43588. return 'CP850';
  43589. }
  43590. if ('UTF8' === $encoding) {
  43591. return 'UTF-8';
  43592. }
  43593. return $encoding;
  43594. }
  43595. }
  43596. <?php
  43597. return array(
  43598. 'A' => 'a',
  43599. 'B' => 'b',
  43600. 'C' => 'c',
  43601. 'D' => 'd',
  43602. 'E' => 'e',
  43603. 'F' => 'f',
  43604. 'G' => 'g',
  43605. 'H' => 'h',
  43606. 'I' => 'i',
  43607. 'J' => 'j',
  43608. 'K' => 'k',
  43609. 'L' => 'l',
  43610. 'M' => 'm',
  43611. 'N' => 'n',
  43612. 'O' => 'o',
  43613. 'P' => 'p',
  43614. 'Q' => 'q',
  43615. 'R' => 'r',
  43616. 'S' => 's',
  43617. 'T' => 't',
  43618. 'U' => 'u',
  43619. 'V' => 'v',
  43620. 'W' => 'w',
  43621. 'X' => 'x',
  43622. 'Y' => 'y',
  43623. 'Z' => 'z',
  43624. 'À' => 'à',
  43625. '�' => 'á',
  43626. 'Â' => 'â',
  43627. 'Ã' => 'ã',
  43628. 'Ä' => 'ä',
  43629. 'Ã…' => 'Ã¥',
  43630. 'Æ' => 'æ',
  43631. 'Ç' => 'ç',
  43632. 'È' => 'è',
  43633. 'É' => 'é',
  43634. 'Ê' => 'ê',
  43635. 'Ë' => 'ë',
  43636. 'Ì' => 'ì',
  43637. '�' => 'í',
  43638. 'Î' => 'î',
  43639. '�' => 'ï',
  43640. '�' => 'ð',
  43641. 'Ñ' => 'ñ',
  43642. 'Ò' => 'ò',
  43643. 'Ó' => 'ó',
  43644. 'Ô' => 'ô',
  43645. 'Õ' => 'õ',
  43646. 'Ö' => 'ö',
  43647. 'Ø' => 'ø',
  43648. 'Ù' => 'ù',
  43649. 'Ú' => 'ú',
  43650. 'Û' => 'û',
  43651. 'Ü' => 'ü',
  43652. '�' => 'ý',
  43653. 'Þ' => 'þ',
  43654. 'Ā' => '�',
  43655. 'Ă' => 'ă',
  43656. 'Ä„' => 'Ä…',
  43657. 'Ć' => 'ć',
  43658. 'Ĉ' => 'ĉ',
  43659. 'ÄŠ' => 'Ä‹',
  43660. 'Č' => '�',
  43661. 'Ď' => '�',
  43662. '�' => 'đ',
  43663. 'Ä’' => 'Ä“',
  43664. 'Ä”' => 'Ä•',
  43665. 'Ä–' => 'Ä—',
  43666. 'Ę' => 'ę',
  43667. 'Äš' => 'Ä›',
  43668. 'Ĝ' => '�',
  43669. 'Äž' => 'ÄŸ',
  43670. 'Ä ' => 'Ä¡',
  43671. 'Ä¢' => 'Ä£',
  43672. 'Ĥ' => 'ĥ',
  43673. 'Ħ' => 'ħ',
  43674. 'Ĩ' => 'ĩ',
  43675. 'Ī' => 'ī',
  43676. 'Ĭ' => 'ĭ',
  43677. 'Į' => 'į',
  43678. 'Ä°' => 'i',
  43679. 'IJ' => 'ij',
  43680. 'Ĵ' => 'ĵ',
  43681. 'Ķ' => 'ķ',
  43682. 'Ĺ' => 'ĺ',
  43683. 'Ļ' => 'ļ',
  43684. 'Ľ' => 'ľ',
  43685. 'Ä¿' => 'Å€',
  43686. '�' => 'ł',
  43687. 'Ń' => 'ń',
  43688. 'Ņ' => 'ņ',
  43689. 'Ň' => 'ň',
  43690. 'ÅŠ' => 'Å‹',
  43691. 'Ō' => '�',
  43692. 'Ŏ' => '�',
  43693. '�' => 'ő',
  43694. 'Å’' => 'Å“',
  43695. 'Å”' => 'Å•',
  43696. 'Å–' => 'Å—',
  43697. 'Ř' => 'ř',
  43698. 'Åš' => 'Å›',
  43699. 'Ŝ' => '�',
  43700. 'Åž' => 'ÅŸ',
  43701. 'Å ' => 'Å¡',
  43702. 'Å¢' => 'Å£',
  43703. 'Ť' => 'ť',
  43704. 'Ŧ' => 'ŧ',
  43705. 'Ũ' => 'ũ',
  43706. 'Ū' => 'ū',
  43707. 'Ŭ' => 'ŭ',
  43708. 'Ů' => 'ů',
  43709. 'Ű' => 'ű',
  43710. 'Ų' => 'ų',
  43711. 'Ŵ' => 'ŵ',
  43712. 'Ŷ' => 'ŷ',
  43713. 'Ÿ' => 'ÿ',
  43714. 'Ź' => 'ź',
  43715. 'Ż' => 'ż',
  43716. 'Ž' => 'ž',
  43717. '�' => 'ɓ',
  43718. 'Ƃ' => 'ƃ',
  43719. 'Æ„' => 'Æ…',
  43720. 'Ɔ' => 'ɔ',
  43721. 'Ƈ' => 'ƈ',
  43722. 'Ɖ' => 'ɖ',
  43723. 'ÆŠ' => 'É—',
  43724. 'Ƌ' => 'ƌ',
  43725. 'Ǝ' => '�',
  43726. '�' => 'ə',
  43727. '�' => 'ɛ',
  43728. 'Æ‘' => 'Æ’',
  43729. 'Æ“' => 'É ',
  43730. 'Æ”' => 'É£',
  43731. 'Æ–' => 'É©',
  43732. 'Ɨ' => 'ɨ',
  43733. 'Ƙ' => 'ƙ',
  43734. 'Ɯ' => 'ɯ',
  43735. '�' => 'ɲ',
  43736. 'Ɵ' => 'ɵ',
  43737. 'Æ ' => 'Æ¡',
  43738. 'Æ¢' => 'Æ£',
  43739. 'Ƥ' => 'ƥ',
  43740. 'Ʀ' => 'ʀ',
  43741. 'Ƨ' => 'ƨ',
  43742. 'Ʃ' => 'ʃ',
  43743. 'Ƭ' => 'ƭ',
  43744. 'Ʈ' => 'ʈ',
  43745. 'Ư' => 'ư',
  43746. 'Ʊ' => 'ʊ',
  43747. 'Ʋ' => 'ʋ',
  43748. 'Ƴ' => 'ƴ',
  43749. 'Ƶ' => 'ƶ',
  43750. 'Æ·' => 'Ê’',
  43751. 'Ƹ' => 'ƹ',
  43752. 'Ƽ' => 'ƽ',
  43753. 'DŽ' => 'dž',
  43754. 'Dž' => 'dž',
  43755. 'LJ' => 'lj',
  43756. 'Lj' => 'lj',
  43757. 'NJ' => 'nj',
  43758. 'Nj' => 'nj',
  43759. '�' => 'ǎ',
  43760. '�' => '�',
  43761. 'Ç‘' => 'Ç’',
  43762. 'Ç“' => 'Ç”',
  43763. 'Ç•' => 'Ç–',
  43764. 'Ǘ' => 'ǘ',
  43765. 'Ç™' => 'Çš',
  43766. 'Ǜ' => 'ǜ',
  43767. 'Çž' => 'ÇŸ',
  43768. 'Ç ' => 'Ç¡',
  43769. 'Ç¢' => 'Ç£',
  43770. 'Ǥ' => 'ǥ',
  43771. 'Ǧ' => 'ǧ',
  43772. 'Ǩ' => 'ǩ',
  43773. 'Ǫ' => 'ǫ',
  43774. 'Ǭ' => 'ǭ',
  43775. 'Ǯ' => 'ǯ',
  43776. 'DZ' => 'dz',
  43777. 'Dz' => 'dz',
  43778. 'Ǵ' => 'ǵ',
  43779. 'Ƕ' => 'ƕ',
  43780. 'Ç·' => 'Æ¿',
  43781. 'Ǹ' => 'ǹ',
  43782. 'Ǻ' => 'ǻ',
  43783. 'Ǽ' => 'ǽ',
  43784. 'Ǿ' => 'ǿ',
  43785. 'Ȁ' => '�',
  43786. 'Ȃ' => 'ȃ',
  43787. 'È„' => 'È…',
  43788. 'Ȇ' => 'ȇ',
  43789. 'Ȉ' => 'ȉ',
  43790. 'ÈŠ' => 'È‹',
  43791. 'Ȍ' => '�',
  43792. 'Ȏ' => '�',
  43793. '�' => 'ȑ',
  43794. 'È’' => 'È“',
  43795. 'È”' => 'È•',
  43796. 'È–' => 'È—',
  43797. 'Ș' => 'ș',
  43798. 'Èš' => 'È›',
  43799. 'Ȝ' => '�',
  43800. 'Èž' => 'ÈŸ',
  43801. 'È ' => 'Æž',
  43802. 'È¢' => 'È£',
  43803. 'Ȥ' => 'ȥ',
  43804. 'Ȧ' => 'ȧ',
  43805. 'Ȩ' => 'ȩ',
  43806. 'Ȫ' => 'ȫ',
  43807. 'Ȭ' => 'ȭ',
  43808. 'Ȯ' => 'ȯ',
  43809. 'Ȱ' => 'ȱ',
  43810. 'Ȳ' => 'ȳ',
  43811. 'Ⱥ' => 'ⱥ',
  43812. 'Ȼ' => 'ȼ',
  43813. 'Ƚ' => 'ƚ',
  43814. 'Ⱦ' => 'ⱦ',
  43815. '�' => 'ɂ',
  43816. 'Ƀ' => 'ƀ',
  43817. 'Ʉ' => 'ʉ',
  43818. 'Ʌ' => 'ʌ',
  43819. 'Ɇ' => 'ɇ',
  43820. 'Ɉ' => 'ɉ',
  43821. 'ÉŠ' => 'É‹',
  43822. 'Ɍ' => '�',
  43823. 'Ɏ' => '�',
  43824. 'Ͱ' => 'ͱ',
  43825. 'Ͳ' => 'ͳ',
  43826. 'Ͷ' => 'ͷ',
  43827. 'Ϳ' => 'ϳ',
  43828. 'Ά' => 'ά',
  43829. 'Έ' => 'έ',
  43830. 'Ή' => 'ή',
  43831. 'Ί' => 'ί',
  43832. 'Ό' => 'ό',
  43833. 'Ύ' => '�',
  43834. '�' => 'ώ',
  43835. 'Α' => 'α',
  43836. 'Β' => 'β',
  43837. 'Γ' => 'γ',
  43838. 'Δ' => 'δ',
  43839. 'Ε' => 'ε',
  43840. 'Ζ' => 'ζ',
  43841. 'Η' => 'η',
  43842. 'Θ' => 'θ',
  43843. 'Ι' => 'ι',
  43844. 'Κ' => 'κ',
  43845. 'Λ' => 'λ',
  43846. 'Μ' => 'μ',
  43847. '�' => 'ν',
  43848. 'Ξ' => 'ξ',
  43849. 'Ο' => 'ο',
  43850. 'Π' => 'π',
  43851. 'Ρ' => '�',
  43852. 'Σ' => 'σ',
  43853. 'Τ' => 'τ',
  43854. 'Î¥' => 'Ï…',
  43855. 'Φ' => 'φ',
  43856. 'Χ' => 'χ',
  43857. 'Ψ' => 'ψ',
  43858. 'Ω' => 'ω',
  43859. 'Ϊ' => 'ϊ',
  43860. 'Ϋ' => 'ϋ',
  43861. '�' => 'ϗ',
  43862. 'Ϙ' => 'ϙ',
  43863. 'Ïš' => 'Ï›',
  43864. 'Ϝ' => '�',
  43865. 'Ïž' => 'ÏŸ',
  43866. 'Ï ' => 'Ï¡',
  43867. 'Ï¢' => 'Ï£',
  43868. 'Ϥ' => 'ϥ',
  43869. 'Ϧ' => 'ϧ',
  43870. 'Ϩ' => 'ϩ',
  43871. 'Ϫ' => 'ϫ',
  43872. 'Ϭ' => 'ϭ',
  43873. 'Ϯ' => 'ϯ',
  43874. 'ϴ' => 'θ',
  43875. 'Ϸ' => 'ϸ',
  43876. 'Ϲ' => 'ϲ',
  43877. 'Ϻ' => 'ϻ',
  43878. 'Ͻ' => 'ͻ',
  43879. 'Ͼ' => 'ͼ',
  43880. 'Ͽ' => 'ͽ',
  43881. 'Ѐ' => '�',
  43882. '�' => 'ё',
  43883. 'Ђ' => 'ђ',
  43884. 'Ѓ' => 'ѓ',
  43885. 'Є' => 'є',
  43886. 'Ð…' => 'Ñ•',
  43887. 'І' => 'і',
  43888. 'Ї' => 'ї',
  43889. 'Ј' => 'ј',
  43890. 'Љ' => 'љ',
  43891. 'Њ' => 'њ',
  43892. 'Ћ' => 'ћ',
  43893. 'Ќ' => 'ќ',
  43894. '�' => '�',
  43895. 'ÐŽ' => 'Ñž',
  43896. '�' => 'џ',
  43897. '�' => 'а',
  43898. 'Б' => 'б',
  43899. 'В' => 'в',
  43900. 'Г' => 'г',
  43901. 'Д' => 'д',
  43902. 'Е' => 'е',
  43903. 'Ж' => 'ж',
  43904. 'З' => 'з',
  43905. 'И' => 'и',
  43906. 'Й' => 'й',
  43907. 'К' => 'к',
  43908. 'Л' => 'л',
  43909. 'М' => 'м',
  43910. '�' => 'н',
  43911. 'О' => 'о',
  43912. 'П' => 'п',
  43913. 'Р' => 'р',
  43914. 'С' => '�',
  43915. 'Т' => 'т',
  43916. 'У' => 'у',
  43917. 'Ф' => 'ф',
  43918. 'Ð¥' => 'Ñ…',
  43919. 'Ц' => 'ц',
  43920. 'Ч' => 'ч',
  43921. 'Ш' => 'ш',
  43922. 'Щ' => 'щ',
  43923. 'Ъ' => 'ъ',
  43924. 'Ы' => 'ы',
  43925. 'Ь' => 'ь',
  43926. 'Э' => '�',
  43927. 'Ю' => 'ю',
  43928. 'Я' => '�',
  43929. 'Ñ ' => 'Ñ¡',
  43930. 'Ñ¢' => 'Ñ£',
  43931. 'Ѥ' => 'ѥ',
  43932. 'Ѧ' => 'ѧ',
  43933. 'Ѩ' => 'ѩ',
  43934. 'Ѫ' => 'ѫ',
  43935. 'Ѭ' => 'ѭ',
  43936. 'Ѯ' => 'ѯ',
  43937. 'Ѱ' => 'ѱ',
  43938. 'Ѳ' => 'ѳ',
  43939. 'Ѵ' => 'ѵ',
  43940. 'Ѷ' => 'ѷ',
  43941. 'Ѹ' => 'ѹ',
  43942. 'Ѻ' => 'ѻ',
  43943. 'Ѽ' => 'ѽ',
  43944. 'Ѿ' => 'ѿ',
  43945. 'Ò€' => 'Ò�',
  43946. 'ÒŠ' => 'Ò‹',
  43947. 'Ҍ' => '�',
  43948. 'ÒŽ' => 'Ò�',
  43949. 'Ò�' => 'Ò‘',
  43950. 'Ò’' => 'Ò“',
  43951. 'Ò”' => 'Ò•',
  43952. 'Ò–' => 'Ò—',
  43953. 'Ò˜' => 'Ò™',
  43954. 'Òš' => 'Ò›',
  43955. 'Ҝ' => '�',
  43956. 'Òž' => 'ÒŸ',
  43957. 'Ò ' => 'Ò¡',
  43958. 'Ò¢' => 'Ò£',
  43959. 'Ò¤' => 'Ò¥',
  43960. 'Ò¦' => 'Ò§',
  43961. 'Ò¨' => 'Ò©',
  43962. 'Òª' => 'Ò«',
  43963. 'Ò¬' => 'Ò­',
  43964. 'Ò®' => 'Ò¯',
  43965. 'Ò°' => 'Ò±',
  43966. 'Ò²' => 'Ò³',
  43967. 'Ò´' => 'Òµ',
  43968. 'Ò¶' => 'Ò·',
  43969. 'Ò¸' => 'Ò¹',
  43970. 'Òº' => 'Ò»',
  43971. 'Ò¼' => 'Ò½',
  43972. 'Ò¾' => 'Ò¿',
  43973. 'Ó€' => 'Ó�',
  43974. 'Ó�' => 'Ó‚',
  43975. 'Óƒ' => 'Ó„',
  43976. 'Ó…' => 'Ó†',
  43977. 'Ó‡' => 'Óˆ',
  43978. 'Ó‰' => 'ÓŠ',
  43979. 'Ӌ' => 'ӌ',
  43980. 'Ó�' => 'ÓŽ',
  43981. 'Ó�' => 'Ó‘',
  43982. 'Ó’' => 'Ó“',
  43983. 'Ó”' => 'Ó•',
  43984. 'Ó–' => 'Ó—',
  43985. 'Ó˜' => 'Ó™',
  43986. 'Óš' => 'Ó›',
  43987. 'Ӝ' => '�',
  43988. 'Óž' => 'ÓŸ',
  43989. 'Ó ' => 'Ó¡',
  43990. 'Ó¢' => 'Ó£',
  43991. 'Ó¤' => 'Ó¥',
  43992. 'Ó¦' => 'Ó§',
  43993. 'Ó¨' => 'Ó©',
  43994. 'Óª' => 'Ó«',
  43995. 'Ó¬' => 'Ó­',
  43996. 'Ó®' => 'Ó¯',
  43997. 'Ó°' => 'Ó±',
  43998. 'Ó²' => 'Ó³',
  43999. 'Ó´' => 'Óµ',
  44000. 'Ó¶' => 'Ó·',
  44001. 'Ó¸' => 'Ó¹',
  44002. 'Óº' => 'Ó»',
  44003. 'Ó¼' => 'Ó½',
  44004. 'Ó¾' => 'Ó¿',
  44005. 'Ô€' => 'Ô�',
  44006. 'Ô‚' => 'Ôƒ',
  44007. 'Ô„' => 'Ô…',
  44008. 'Ô†' => 'Ô‡',
  44009. 'Ôˆ' => 'Ô‰',
  44010. 'ÔŠ' => 'Ô‹',
  44011. 'Ԍ' => '�',
  44012. 'ÔŽ' => 'Ô�',
  44013. 'Ô�' => 'Ô‘',
  44014. 'Ô’' => 'Ô“',
  44015. 'Ô”' => 'Ô•',
  44016. 'Ô–' => 'Ô—',
  44017. 'Ô˜' => 'Ô™',
  44018. 'Ôš' => 'Ô›',
  44019. 'Ԝ' => '�',
  44020. 'Ôž' => 'ÔŸ',
  44021. 'Ô ' => 'Ô¡',
  44022. 'Ô¢' => 'Ô£',
  44023. 'Ô¤' => 'Ô¥',
  44024. 'Ô¦' => 'Ô§',
  44025. 'Ô¨' => 'Ô©',
  44026. 'Ôª' => 'Ô«',
  44027. 'Ô¬' => 'Ô­',
  44028. 'Ô®' => 'Ô¯',
  44029. 'Ô±' => 'Õ¡',
  44030. 'Ô²' => 'Õ¢',
  44031. 'Ô³' => 'Õ£',
  44032. 'Ô´' => 'Õ¤',
  44033. 'Ôµ' => 'Õ¥',
  44034. 'Ô¶' => 'Õ¦',
  44035. 'Ô·' => 'Õ§',
  44036. 'Ô¸' => 'Õ¨',
  44037. 'Ô¹' => 'Õ©',
  44038. 'Ôº' => 'Õª',
  44039. 'Ô»' => 'Õ«',
  44040. 'Ô¼' => 'Õ¬',
  44041. 'Ô½' => 'Õ­',
  44042. 'Ô¾' => 'Õ®',
  44043. 'Ô¿' => 'Õ¯',
  44044. 'Õ€' => 'Õ°',
  44045. 'Õ�' => 'Õ±',
  44046. 'Õ‚' => 'Õ²',
  44047. 'Õƒ' => 'Õ³',
  44048. 'Õ„' => 'Õ´',
  44049. 'Õ…' => 'Õµ',
  44050. 'Õ†' => 'Õ¶',
  44051. 'Õ‡' => 'Õ·',
  44052. 'Õˆ' => 'Õ¸',
  44053. 'Õ‰' => 'Õ¹',
  44054. 'ÕŠ' => 'Õº',
  44055. 'Õ‹' => 'Õ»',
  44056. 'Ռ' => 'ռ',
  44057. 'Õ�' => 'Õ½',
  44058. 'ÕŽ' => 'Õ¾',
  44059. 'Õ�' => 'Õ¿',
  44060. 'Õ�' => 'Ö€',
  44061. 'Õ‘' => 'Ö�',
  44062. 'Õ’' => 'Ö‚',
  44063. 'Õ“' => 'Öƒ',
  44064. 'Õ”' => 'Ö„',
  44065. 'Õ•' => 'Ö…',
  44066. 'Õ–' => 'Ö†',
  44067. 'á‚ ' => 'â´€',
  44068. 'á‚¡' => 'â´�',
  44069. 'á‚¢' => 'â´‚',
  44070. 'á‚£' => 'â´ƒ',
  44071. 'Ⴄ' => 'ⴄ',
  44072. 'á‚¥' => 'â´…',
  44073. 'Ⴆ' => 'ⴆ',
  44074. 'Ⴇ' => 'ⴇ',
  44075. 'Ⴈ' => 'ⴈ',
  44076. 'á‚©' => 'â´‰',
  44077. 'Ⴊ' => 'ⴊ',
  44078. 'á‚«' => 'â´‹',
  44079. 'Ⴌ' => 'ⴌ',
  44080. 'á‚­' => 'â´�',
  44081. 'á‚®' => 'â´Ž',
  44082. 'Ⴏ' => '�',
  44083. 'á‚°' => 'â´�',
  44084. 'Ⴑ' => 'ⴑ',
  44085. 'Ⴒ' => 'ⴒ',
  44086. 'Ⴓ' => 'ⴓ',
  44087. 'á‚´' => 'â´”',
  44088. 'Ⴕ' => 'ⴕ',
  44089. 'Ⴖ' => 'ⴖ',
  44090. 'á‚·' => 'â´—',
  44091. 'Ⴘ' => 'ⴘ',
  44092. 'Ⴙ' => 'ⴙ',
  44093. 'Ⴚ' => 'ⴚ',
  44094. 'á‚»' => 'â´›',
  44095. 'Ⴜ' => 'ⴜ',
  44096. 'Ⴝ' => '�',
  44097. 'Ⴞ' => 'ⴞ',
  44098. 'á‚¿' => 'â´Ÿ',
  44099. 'Ⴠ' => 'ⴠ',
  44100. '�' => 'ⴡ',
  44101. 'Ⴢ' => 'ⴢ',
  44102. 'Ⴣ' => 'ⴣ',
  44103. 'Ⴤ' => 'ⴤ',
  44104. 'Ⴥ' => 'ⴥ',
  44105. 'Ⴧ' => 'ⴧ',
  44106. '�' => 'ⴭ',
  44107. 'Ḁ' => '�',
  44108. 'Ḃ' => 'ḃ',
  44109. 'Ḅ' => 'ḅ',
  44110. 'Ḇ' => 'ḇ',
  44111. 'Ḉ' => 'ḉ',
  44112. 'Ḋ' => 'ḋ',
  44113. 'Ḍ' => '�',
  44114. 'Ḏ' => '�',
  44115. '�' => 'ḑ',
  44116. 'Ḓ' => 'ḓ',
  44117. 'Ḕ' => 'ḕ',
  44118. 'Ḗ' => 'ḗ',
  44119. 'Ḙ' => 'ḙ',
  44120. 'Ḛ' => 'ḛ',
  44121. 'Ḝ' => '�',
  44122. 'Ḟ' => 'ḟ',
  44123. 'Ḡ' => 'ḡ',
  44124. 'Ḣ' => 'ḣ',
  44125. 'Ḥ' => 'ḥ',
  44126. 'Ḧ' => 'ḧ',
  44127. 'Ḩ' => 'ḩ',
  44128. 'Ḫ' => 'ḫ',
  44129. 'Ḭ' => 'ḭ',
  44130. 'Ḯ' => 'ḯ',
  44131. 'Ḱ' => 'ḱ',
  44132. 'Ḳ' => 'ḳ',
  44133. 'Ḵ' => 'ḵ',
  44134. 'Ḷ' => 'ḷ',
  44135. 'Ḹ' => 'ḹ',
  44136. 'Ḻ' => 'ḻ',
  44137. 'Ḽ' => 'ḽ',
  44138. 'Ḿ' => 'ḿ',
  44139. 'Ṁ' => '�',
  44140. 'Ṃ' => 'ṃ',
  44141. 'Ṅ' => 'ṅ',
  44142. 'Ṇ' => 'ṇ',
  44143. 'Ṉ' => 'ṉ',
  44144. 'Ṋ' => 'ṋ',
  44145. 'Ṍ' => '�',
  44146. 'Ṏ' => '�',
  44147. '�' => 'ṑ',
  44148. 'Ṓ' => 'ṓ',
  44149. 'Ṕ' => 'ṕ',
  44150. 'á¹–' => 'á¹—',
  44151. 'Ṙ' => 'ṙ',
  44152. 'Ṛ' => 'ṛ',
  44153. 'Ṝ' => '�',
  44154. 'Ṟ' => 'ṟ',
  44155. 'Ṡ' => 'ṡ',
  44156. 'á¹¢' => 'á¹£',
  44157. 'Ṥ' => 'ṥ',
  44158. 'Ṧ' => 'ṧ',
  44159. 'Ṩ' => 'ṩ',
  44160. 'Ṫ' => 'ṫ',
  44161. 'Ṭ' => 'ṭ',
  44162. 'Ṯ' => 'ṯ',
  44163. 'á¹°' => 'á¹±',
  44164. 'á¹²' => 'á¹³',
  44165. 'á¹´' => 'á¹µ',
  44166. 'Ṷ' => 'ṷ',
  44167. 'Ṹ' => 'ṹ',
  44168. 'Ṻ' => 'ṻ',
  44169. 'á¹¼' => 'á¹½',
  44170. 'Ṿ' => 'ṿ',
  44171. 'Ẁ' => '�',
  44172. 'Ẃ' => 'ẃ',
  44173. 'Ẅ' => 'ẅ',
  44174. 'Ẇ' => 'ẇ',
  44175. 'Ẉ' => 'ẉ',
  44176. 'Ẋ' => 'ẋ',
  44177. 'Ẍ' => '�',
  44178. 'Ẏ' => '�',
  44179. '�' => 'ẑ',
  44180. 'Ẓ' => 'ẓ',
  44181. 'Ẕ' => 'ẕ',
  44182. 'ẞ' => 'ß',
  44183. 'Ạ' => 'ạ',
  44184. 'Ả' => 'ả',
  44185. 'Ấ' => 'ấ',
  44186. 'Ầ' => 'ầ',
  44187. 'Ẩ' => 'ẩ',
  44188. 'Ẫ' => 'ẫ',
  44189. 'Ậ' => 'ậ',
  44190. 'Ắ' => 'ắ',
  44191. 'Ằ' => 'ằ',
  44192. 'Ẳ' => 'ẳ',
  44193. 'Ẵ' => 'ẵ',
  44194. 'Ặ' => 'ặ',
  44195. 'Ẹ' => 'ẹ',
  44196. 'Ẻ' => 'ẻ',
  44197. 'Ẽ' => 'ẽ',
  44198. 'Ế' => 'ế',
  44199. 'Ề' => '�',
  44200. 'Ể' => 'ể',
  44201. 'Ễ' => 'ễ',
  44202. 'Ệ' => 'ệ',
  44203. 'Ỉ' => 'ỉ',
  44204. 'Ị' => 'ị',
  44205. 'Ọ' => '�',
  44206. 'Ỏ' => '�',
  44207. '�' => 'ố',
  44208. 'Ồ' => 'ồ',
  44209. 'Ổ' => 'ổ',
  44210. 'á»–' => 'á»—',
  44211. 'Ộ' => 'ộ',
  44212. 'Ớ' => 'ớ',
  44213. 'Ờ' => '�',
  44214. 'Ở' => 'ở',
  44215. 'Ỡ' => 'ỡ',
  44216. 'Ợ' => 'ợ',
  44217. 'Ụ' => 'ụ',
  44218. 'Ủ' => 'ủ',
  44219. 'Ứ' => 'ứ',
  44220. 'Ừ' => 'ừ',
  44221. 'Ử' => 'ử',
  44222. 'Ữ' => 'ữ',
  44223. 'á»°' => 'á»±',
  44224. 'Ỳ' => 'ỳ',
  44225. 'Ỵ' => 'ỵ',
  44226. 'Ỷ' => 'ỷ',
  44227. 'Ỹ' => 'ỹ',
  44228. 'Ỻ' => 'ỻ',
  44229. 'Ỽ' => 'ỽ',
  44230. 'Ỿ' => 'ỿ',
  44231. 'Ἀ' => 'ἀ',
  44232. 'Ἁ' => '�',
  44233. 'Ἂ' => 'ἂ',
  44234. 'Ἃ' => 'ἃ',
  44235. 'Ἄ' => 'ἄ',
  44236. '�' => 'ἅ',
  44237. 'Ἆ' => 'ἆ',
  44238. '�' => 'ἇ',
  44239. 'Ἐ' => '�',
  44240. 'Ἑ' => 'ἑ',
  44241. 'Ἒ' => 'ἒ',
  44242. 'Ἓ' => 'ἓ',
  44243. 'Ἔ' => 'ἔ',
  44244. '�' => 'ἕ',
  44245. 'Ἠ' => 'ἠ',
  44246. 'Ἡ' => 'ἡ',
  44247. 'Ἢ' => 'ἢ',
  44248. 'Ἣ' => 'ἣ',
  44249. 'Ἤ' => 'ἤ',
  44250. 'á¼­' => 'á¼¥',
  44251. 'Ἦ' => 'ἦ',
  44252. 'Ἧ' => 'ἧ',
  44253. 'Ἰ' => 'ἰ',
  44254. 'á¼¹' => 'á¼±',
  44255. 'Ἲ' => 'ἲ',
  44256. 'á¼»' => 'á¼³',
  44257. 'á¼¼' => 'á¼´',
  44258. 'á¼½' => 'á¼µ',
  44259. 'Ἶ' => 'ἶ',
  44260. 'Ἷ' => 'ἷ',
  44261. 'Ὀ' => 'ὀ',
  44262. 'Ὁ' => '�',
  44263. 'Ὂ' => 'ὂ',
  44264. 'Ὃ' => 'ὃ',
  44265. 'Ὄ' => 'ὄ',
  44266. '�' => 'ὅ',
  44267. 'Ὑ' => 'ὑ',
  44268. 'Ὓ' => 'ὓ',
  44269. '�' => 'ὕ',
  44270. 'Ὗ' => 'ὗ',
  44271. 'Ὠ' => 'ὠ',
  44272. 'Ὡ' => 'ὡ',
  44273. 'Ὢ' => 'ὢ',
  44274. 'Ὣ' => 'ὣ',
  44275. 'Ὤ' => 'ὤ',
  44276. 'á½­' => 'á½¥',
  44277. 'Ὦ' => 'ὦ',
  44278. 'Ὧ' => 'ὧ',
  44279. 'ᾈ' => 'ᾀ',
  44280. 'ᾉ' => '�',
  44281. 'ᾊ' => 'ᾂ',
  44282. 'ᾋ' => 'ᾃ',
  44283. 'ᾌ' => 'ᾄ',
  44284. '�' => 'ᾅ',
  44285. 'ᾎ' => 'ᾆ',
  44286. '�' => 'ᾇ',
  44287. 'ᾘ' => '�',
  44288. 'ᾙ' => 'ᾑ',
  44289. 'ᾚ' => 'ᾒ',
  44290. 'ᾛ' => 'ᾓ',
  44291. 'ᾜ' => 'ᾔ',
  44292. '�' => 'ᾕ',
  44293. 'ᾞ' => 'ᾖ',
  44294. 'ᾟ' => 'ᾗ',
  44295. 'ᾨ' => 'ᾠ',
  44296. 'ᾩ' => 'ᾡ',
  44297. 'ᾪ' => 'ᾢ',
  44298. 'ᾫ' => 'ᾣ',
  44299. 'ᾬ' => 'ᾤ',
  44300. 'á¾­' => 'á¾¥',
  44301. 'ᾮ' => 'ᾦ',
  44302. 'ᾯ' => 'ᾧ',
  44303. 'Ᾰ' => 'ᾰ',
  44304. 'á¾¹' => 'á¾±',
  44305. 'Ὰ' => 'ὰ',
  44306. 'á¾»' => 'á½±',
  44307. 'á¾¼' => 'á¾³',
  44308. 'Ὲ' => 'ὲ',
  44309. 'Έ' => 'έ',
  44310. 'á¿Š' => 'á½´',
  44311. 'á¿‹' => 'á½µ',
  44312. 'ῌ' => 'ῃ',
  44313. 'Ῐ' => '�',
  44314. 'á¿™' => 'á¿‘',
  44315. 'Ὶ' => 'ὶ',
  44316. 'á¿›' => 'á½·',
  44317. 'Ῠ' => 'ῠ',
  44318. 'á¿©' => 'á¿¡',
  44319. 'Ὺ' => 'ὺ',
  44320. 'á¿«' => 'á½»',
  44321. 'Ῥ' => 'ῥ',
  44322. 'Ὸ' => 'ὸ',
  44323. 'Ό' => 'ό',
  44324. 'Ὼ' => 'ὼ',
  44325. 'á¿»' => 'á½½',
  44326. 'ῼ' => 'ῳ',
  44327. 'Ω' => 'ω',
  44328. 'K' => 'k',
  44329. 'â„«' => 'Ã¥',
  44330. 'Ⅎ' => 'ⅎ',
  44331. 'â… ' => 'â…°',
  44332. 'â…¡' => 'â…±',
  44333. 'â…¢' => 'â…²',
  44334. 'â…£' => 'â…³',
  44335. 'â…¤' => 'â…´',
  44336. 'â…¥' => 'â…µ',
  44337. 'â…¦' => 'â…¶',
  44338. 'â…§' => 'â…·',
  44339. 'â…¨' => 'â…¸',
  44340. 'â…©' => 'â…¹',
  44341. 'â…ª' => 'â…º',
  44342. 'â…«' => 'â…»',
  44343. 'â…¬' => 'â…¼',
  44344. 'â…­' => 'â…½',
  44345. 'â…®' => 'â…¾',
  44346. 'â…¯' => 'â…¿',
  44347. 'Ↄ' => 'ↄ',
  44348. 'Ⓐ' => '�',
  44349. 'â’·' => 'â“‘',
  44350. 'â’¸' => 'â“’',
  44351. 'â’¹' => 'â““',
  44352. 'â’º' => 'â“”',
  44353. 'â’»' => 'â“•',
  44354. 'â’¼' => 'â“–',
  44355. 'â’½' => 'â“—',
  44356. 'Ⓘ' => 'ⓘ',
  44357. 'â’¿' => 'â“™',
  44358. 'â“€' => 'â“š',
  44359. '�' => 'ⓛ',
  44360. 'Ⓜ' => 'ⓜ',
  44361. 'Ⓝ' => '�',
  44362. 'â“„' => 'â“ž',
  44363. 'â“…' => 'â“Ÿ',
  44364. 'Ⓠ' => 'ⓠ',
  44365. 'Ⓡ' => 'ⓡ',
  44366. 'Ⓢ' => 'ⓢ',
  44367. 'Ⓣ' => 'ⓣ',
  44368. 'Ⓤ' => 'ⓤ',
  44369. 'â“‹' => 'â“¥',
  44370. 'Ⓦ' => 'ⓦ',
  44371. '�' => 'ⓧ',
  44372. 'Ⓨ' => 'ⓨ',
  44373. '�' => 'ⓩ',
  44374. 'â°€' => 'â°°',
  44375. 'â°�' => 'â°±',
  44376. 'â°‚' => 'â°²',
  44377. 'â°ƒ' => 'â°³',
  44378. 'â°„' => 'â°´',
  44379. 'â°…' => 'â°µ',
  44380. 'â°†' => 'â°¶',
  44381. 'â°‡' => 'â°·',
  44382. 'â°ˆ' => 'â°¸',
  44383. 'â°‰' => 'â°¹',
  44384. 'â°Š' => 'â°º',
  44385. 'â°‹' => 'â°»',
  44386. 'Ⰼ' => 'ⰼ',
  44387. 'â°�' => 'â°½',
  44388. 'â°Ž' => 'â°¾',
  44389. 'â°�' => 'â°¿',
  44390. 'â°�' => 'â±€',
  44391. 'Ⱁ' => '�',
  44392. 'Ⱂ' => 'ⱂ',
  44393. 'Ⱃ' => 'ⱃ',
  44394. 'Ⱄ' => 'ⱄ',
  44395. 'â°•' => 'â±…',
  44396. 'Ⱆ' => 'ⱆ',
  44397. 'Ⱇ' => 'ⱇ',
  44398. 'Ⱈ' => 'ⱈ',
  44399. 'Ⱉ' => 'ⱉ',
  44400. 'Ⱊ' => 'ⱊ',
  44401. 'Ⱋ' => 'ⱋ',
  44402. 'Ⱌ' => 'ⱌ',
  44403. '�' => '�',
  44404. 'Ⱎ' => 'ⱎ',
  44405. 'Ⱏ' => '�',
  44406. 'Ⱐ' => '�',
  44407. 'Ⱑ' => 'ⱑ',
  44408. 'â°¢' => 'â±’',
  44409. 'Ⱓ' => 'ⱓ',
  44410. 'â°¤' => 'â±”',
  44411. 'Ⱕ' => 'ⱕ',
  44412. 'â°¦' => 'â±–',
  44413. 'â°§' => 'â±—',
  44414. 'Ⱘ' => 'ⱘ',
  44415. 'â°©' => 'â±™',
  44416. 'Ⱚ' => 'ⱚ',
  44417. 'â°«' => 'â±›',
  44418. 'Ⱜ' => 'ⱜ',
  44419. 'Ⱝ' => '�',
  44420. 'Ⱞ' => 'ⱞ',
  44421. 'Ⱡ' => 'ⱡ',
  44422. 'â±¢' => 'É«',
  44423. 'â±£' => 'áµ½',
  44424. 'Ɽ' => 'ɽ',
  44425. 'Ⱨ' => 'ⱨ',
  44426. 'Ⱪ' => 'ⱪ',
  44427. 'Ⱬ' => 'ⱬ',
  44428. 'â±­' => 'É‘',
  44429. 'Ɱ' => 'ɱ',
  44430. 'Ɐ' => '�',
  44431. 'â±°' => 'É’',
  44432. 'â±²' => 'â±³',
  44433. 'Ⱶ' => 'ⱶ',
  44434. 'â±¾' => 'È¿',
  44435. 'Ɀ' => 'ɀ',
  44436. 'Ⲁ' => '�',
  44437. 'Ⲃ' => 'ⲃ',
  44438. 'Ⲅ' => 'ⲅ',
  44439. 'Ⲇ' => 'ⲇ',
  44440. 'Ⲉ' => 'ⲉ',
  44441. 'Ⲋ' => 'ⲋ',
  44442. 'Ⲍ' => '�',
  44443. 'Ⲏ' => '�',
  44444. '�' => 'ⲑ',
  44445. 'Ⲓ' => 'ⲓ',
  44446. 'Ⲕ' => 'ⲕ',
  44447. 'â²–' => 'â²—',
  44448. 'Ⲙ' => 'ⲙ',
  44449. 'Ⲛ' => 'ⲛ',
  44450. 'Ⲝ' => '�',
  44451. 'Ⲟ' => 'ⲟ',
  44452. 'Ⲡ' => 'ⲡ',
  44453. 'â²¢' => 'â²£',
  44454. 'Ⲥ' => 'ⲥ',
  44455. 'Ⲧ' => 'ⲧ',
  44456. 'Ⲩ' => 'ⲩ',
  44457. 'Ⲫ' => 'ⲫ',
  44458. 'Ⲭ' => 'ⲭ',
  44459. 'Ⲯ' => 'ⲯ',
  44460. 'â²°' => 'â²±',
  44461. 'â²²' => 'â²³',
  44462. 'â²´' => 'â²µ',
  44463. 'Ⲷ' => 'ⲷ',
  44464. 'Ⲹ' => 'ⲹ',
  44465. 'Ⲻ' => 'ⲻ',
  44466. 'â²¼' => 'â²½',
  44467. 'Ⲿ' => 'ⲿ',
  44468. 'Ⳁ' => '�',
  44469. 'Ⳃ' => 'ⳃ',
  44470. 'Ⳅ' => 'ⳅ',
  44471. 'Ⳇ' => 'ⳇ',
  44472. 'Ⳉ' => 'ⳉ',
  44473. 'Ⳋ' => 'ⳋ',
  44474. 'Ⳍ' => '�',
  44475. 'Ⳏ' => '�',
  44476. '�' => 'ⳑ',
  44477. 'Ⳓ' => 'ⳓ',
  44478. 'Ⳕ' => 'ⳕ',
  44479. 'â³–' => 'â³—',
  44480. 'Ⳙ' => 'ⳙ',
  44481. 'Ⳛ' => 'ⳛ',
  44482. 'Ⳝ' => '�',
  44483. 'Ⳟ' => 'ⳟ',
  44484. 'Ⳡ' => 'ⳡ',
  44485. 'â³¢' => 'â³£',
  44486. 'Ⳬ' => 'ⳬ',
  44487. 'â³­' => 'â³®',
  44488. 'â³²' => 'â³³',
  44489. 'Ꙁ' => '�',
  44490. 'Ꙃ' => 'ꙃ',
  44491. 'Ꙅ' => 'ꙅ',
  44492. 'Ꙇ' => 'ꙇ',
  44493. 'Ꙉ' => 'ꙉ',
  44494. 'Ꙋ' => 'ꙋ',
  44495. 'Ꙍ' => '�',
  44496. 'Ꙏ' => '�',
  44497. '�' => 'ꙑ',
  44498. 'Ꙓ' => 'ꙓ',
  44499. 'Ꙕ' => 'ꙕ',
  44500. 'ê™–' => 'ê™—',
  44501. 'Ꙙ' => 'ꙙ',
  44502. 'Ꙛ' => 'ꙛ',
  44503. 'Ꙝ' => '�',
  44504. 'Ꙟ' => 'ꙟ',
  44505. 'Ꙡ' => 'ꙡ',
  44506. 'Ꙣ' => 'ꙣ',
  44507. 'Ꙥ' => 'ꙥ',
  44508. 'Ꙧ' => 'ꙧ',
  44509. 'Ꙩ' => 'ꙩ',
  44510. 'Ꙫ' => 'ꙫ',
  44511. 'Ꙭ' => 'ꙭ',
  44512. 'Ꚁ' => '�',
  44513. 'Ꚃ' => 'ꚃ',
  44514. 'êš„' => 'êš…',
  44515. 'Ꚇ' => 'ꚇ',
  44516. 'Ꚉ' => 'ꚉ',
  44517. 'Ꚋ' => 'ꚋ',
  44518. 'Ꚍ' => '�',
  44519. 'Ꚏ' => '�',
  44520. '�' => 'ꚑ',
  44521. 'êš’' => 'êš“',
  44522. 'êš”' => 'êš•',
  44523. 'êš–' => 'êš—',
  44524. 'Ꚙ' => 'ꚙ',
  44525. 'êšš' => 'êš›',
  44526. 'Ꜣ' => 'ꜣ',
  44527. 'Ꜥ' => 'ꜥ',
  44528. 'Ꜧ' => 'ꜧ',
  44529. 'Ꜩ' => 'ꜩ',
  44530. 'Ꜫ' => 'ꜫ',
  44531. 'Ꜭ' => 'ꜭ',
  44532. 'Ꜯ' => 'ꜯ',
  44533. 'Ꜳ' => 'ꜳ',
  44534. 'Ꜵ' => 'ꜵ',
  44535. 'Ꜷ' => 'ꜷ',
  44536. 'Ꜹ' => 'ꜹ',
  44537. 'Ꜻ' => 'ꜻ',
  44538. 'Ꜽ' => 'ꜽ',
  44539. 'Ꜿ' => 'ꜿ',
  44540. '�' => '�',
  44541. '�' => '�',
  44542. '�' => '�',
  44543. '�' => '�',
  44544. '�' => '�',
  44545. '�' => '�',
  44546. '�' => '�',
  44547. '�' => '�',
  44548. '�' => '�',
  44549. '�' => '�',
  44550. '�' => '�',
  44551. '�' => '�',
  44552. '�' => '�',
  44553. '�' => '�',
  44554. '�' => '�',
  44555. '�' => '�',
  44556. '�' => '�',
  44557. '�' => '�',
  44558. '�' => '�',
  44559. '�' => '�',
  44560. '�' => '�',
  44561. '�' => '�',
  44562. '�' => '�',
  44563. '�' => '�',
  44564. '�' => '�',
  44565. '�' => '�',
  44566. '�' => 'ᵹ',
  44567. '�' => '�',
  44568. 'Ꞁ' => '�',
  44569. 'Ꞃ' => 'ꞃ',
  44570. 'êž„' => 'êž…',
  44571. 'Ꞇ' => 'ꞇ',
  44572. 'Ꞌ' => 'ꞌ',
  44573. '�' => 'ɥ',
  44574. '�' => 'ꞑ',
  44575. 'êž’' => 'êž“',
  44576. 'êž–' => 'êž—',
  44577. 'Ꞙ' => 'ꞙ',
  44578. 'êžš' => 'êž›',
  44579. 'Ꞝ' => '�',
  44580. 'Ꞟ' => 'ꞟ',
  44581. 'êž ' => 'êž¡',
  44582. 'Ꞣ' => 'ꞣ',
  44583. 'Ꞥ' => 'ꞥ',
  44584. 'Ꞧ' => 'ꞧ',
  44585. 'Ꞩ' => 'ꞩ',
  44586. 'Ɦ' => 'ɦ',
  44587. 'Ɜ' => 'ɜ',
  44588. 'Ɡ' => 'ɡ',
  44589. 'Ɬ' => 'ɬ',
  44590. 'êž°' => 'Êž',
  44591. 'Ʇ' => 'ʇ',
  44592. 'A' => '�',
  44593. 'B' => 'b',
  44594. 'C' => 'c',
  44595. 'D' => 'd',
  44596. 'ï¼¥' => 'ï½…',
  44597. 'F' => 'f',
  44598. 'G' => 'g',
  44599. 'H' => 'h',
  44600. 'I' => 'i',
  44601. 'J' => 'j',
  44602. 'K' => 'k',
  44603. 'L' => 'l',
  44604. 'M' => '�',
  44605. 'N' => 'n',
  44606. 'O' => '�',
  44607. 'P' => '�',
  44608. 'Q' => 'q',
  44609. 'ï¼²' => 'ï½’',
  44610. 'S' => 's',
  44611. 'ï¼´' => 'ï½”',
  44612. 'U' => 'u',
  44613. 'V' => 'v',
  44614. 'ï¼·' => 'ï½—',
  44615. 'X' => 'x',
  44616. 'ï¼¹' => 'ï½™',
  44617. 'Z' => 'z',
  44618. '�' => '�',
  44619. '�' => '�',
  44620. '�' => '�',
  44621. '�' => '�',
  44622. '�' => '�',
  44623. '�' => '�',
  44624. '�' => '�',
  44625. '�' => '�',
  44626. '�' => '�',
  44627. '�' => '�',
  44628. '�' => '�',
  44629. '�' => '�',
  44630. '�' => '�',
  44631. '�' => '�',
  44632. '�' => '�',
  44633. '�' => '�',
  44634. '�' => '�',
  44635. '�' => '�',
  44636. '�' => '�',
  44637. '�' => '�',
  44638. '�' => '�',
  44639. '�' => '�',
  44640. '�' => '�',
  44641. '�' => '�',
  44642. '�' => '�',
  44643. '�' => '�',
  44644. '�' => '�',
  44645. '�' => '�',
  44646. '�' => '�',
  44647. '�' => '�',
  44648. '�' => '�',
  44649. '�' => '�',
  44650. '�' => '�',
  44651. '�' => '�',
  44652. '�' => '�',
  44653. '�' => '�',
  44654. '�' => '�',
  44655. '�' => '�',
  44656. '�' => '�',
  44657. '�' => '�',
  44658. 'ð‘¢ ' => 'ð‘£€',
  44659. '𑢡' => '�',
  44660. '𑢢' => '𑣂',
  44661. '𑢣' => '𑣃',
  44662. '𑢤' => '𑣄',
  44663. 'ð‘¢¥' => 'ð‘£…',
  44664. '𑢦' => '𑣆',
  44665. '𑢧' => '𑣇',
  44666. '𑢨' => '𑣈',
  44667. '𑢩' => '𑣉',
  44668. '𑢪' => '𑣊',
  44669. '𑢫' => '𑣋',
  44670. '𑢬' => '𑣌',
  44671. '𑢭' => '�',
  44672. '𑢮' => '𑣎',
  44673. '𑢯' => '�',
  44674. '𑢰' => '�',
  44675. '𑢱' => '𑣑',
  44676. 'ð‘¢²' => 'ð‘£’',
  44677. '𑢳' => '𑣓',
  44678. 'ð‘¢´' => 'ð‘£”',
  44679. '𑢵' => '𑣕',
  44680. '𑢶' => '𑣖',
  44681. 'ð‘¢·' => 'ð‘£—',
  44682. '𑢸' => '𑣘',
  44683. 'ð‘¢¹' => 'ð‘£™',
  44684. '𑢺' => '𑣚',
  44685. 'ð‘¢»' => 'ð‘£›',
  44686. '𑢼' => '𑣜',
  44687. '𑢽' => '�',
  44688. '𑢾' => '𑣞',
  44689. '𑢿' => '𑣟',
  44690. );
  44691. <?php
  44692. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  44693. <?php
  44694. return array(
  44695. 'a' => 'A',
  44696. 'b' => 'B',
  44697. 'c' => 'C',
  44698. 'd' => 'D',
  44699. 'e' => 'E',
  44700. 'f' => 'F',
  44701. 'g' => 'G',
  44702. 'h' => 'H',
  44703. 'i' => 'I',
  44704. 'j' => 'J',
  44705. 'k' => 'K',
  44706. 'l' => 'L',
  44707. 'm' => 'M',
  44708. 'n' => 'N',
  44709. 'o' => 'O',
  44710. 'p' => 'P',
  44711. 'q' => 'Q',
  44712. 'r' => 'R',
  44713. 's' => 'S',
  44714. 't' => 'T',
  44715. 'u' => 'U',
  44716. 'v' => 'V',
  44717. 'w' => 'W',
  44718. 'x' => 'X',
  44719. 'y' => 'Y',
  44720. 'z' => 'Z',
  44721. 'µ' => 'Μ',
  44722. 'à' => 'À',
  44723. 'á' => '�',
  44724. 'â' => 'Â',
  44725. 'ã' => 'Ã',
  44726. 'ä' => 'Ä',
  44727. 'Ã¥' => 'Ã…',
  44728. 'æ' => 'Æ',
  44729. 'ç' => 'Ç',
  44730. 'è' => 'È',
  44731. 'é' => 'É',
  44732. 'ê' => 'Ê',
  44733. 'ë' => 'Ë',
  44734. 'ì' => 'Ì',
  44735. 'í' => '�',
  44736. 'î' => 'Î',
  44737. 'ï' => '�',
  44738. 'ð' => '�',
  44739. 'ñ' => 'Ñ',
  44740. 'ò' => 'Ò',
  44741. 'ó' => 'Ó',
  44742. 'ô' => 'Ô',
  44743. 'õ' => 'Õ',
  44744. 'ö' => 'Ö',
  44745. 'ø' => 'Ø',
  44746. 'ù' => 'Ù',
  44747. 'ú' => 'Ú',
  44748. 'û' => 'Û',
  44749. 'ü' => 'Ü',
  44750. 'ý' => '�',
  44751. 'þ' => 'Þ',
  44752. 'ÿ' => 'Ÿ',
  44753. '�' => 'Ā',
  44754. 'ă' => 'Ă',
  44755. 'Ä…' => 'Ä„',
  44756. 'ć' => 'Ć',
  44757. 'ĉ' => 'Ĉ',
  44758. 'Ä‹' => 'ÄŠ',
  44759. '�' => 'Č',
  44760. '�' => 'Ď',
  44761. 'đ' => '�',
  44762. 'Ä“' => 'Ä’',
  44763. 'Ä•' => 'Ä”',
  44764. 'Ä—' => 'Ä–',
  44765. 'ę' => 'Ę',
  44766. 'Ä›' => 'Äš',
  44767. '�' => 'Ĝ',
  44768. 'ÄŸ' => 'Äž',
  44769. 'Ä¡' => 'Ä ',
  44770. 'Ä£' => 'Ä¢',
  44771. 'ĥ' => 'Ĥ',
  44772. 'ħ' => 'Ħ',
  44773. 'ĩ' => 'Ĩ',
  44774. 'ī' => 'Ī',
  44775. 'ĭ' => 'Ĭ',
  44776. 'į' => 'Į',
  44777. 'ı' => 'I',
  44778. 'ij' => 'IJ',
  44779. 'ĵ' => 'Ĵ',
  44780. 'ķ' => 'Ķ',
  44781. 'ĺ' => 'Ĺ',
  44782. 'ļ' => 'Ļ',
  44783. 'ľ' => 'Ľ',
  44784. 'Å€' => 'Ä¿',
  44785. 'ł' => '�',
  44786. 'ń' => 'Ń',
  44787. 'ņ' => 'Ņ',
  44788. 'ň' => 'Ň',
  44789. 'Å‹' => 'ÅŠ',
  44790. '�' => 'Ō',
  44791. '�' => 'Ŏ',
  44792. 'ő' => '�',
  44793. 'Å“' => 'Å’',
  44794. 'Å•' => 'Å”',
  44795. 'Å—' => 'Å–',
  44796. 'ř' => 'Ř',
  44797. 'Å›' => 'Åš',
  44798. '�' => 'Ŝ',
  44799. 'ÅŸ' => 'Åž',
  44800. 'Å¡' => 'Å ',
  44801. 'Å£' => 'Å¢',
  44802. 'ť' => 'Ť',
  44803. 'ŧ' => 'Ŧ',
  44804. 'ũ' => 'Ũ',
  44805. 'ū' => 'Ū',
  44806. 'ŭ' => 'Ŭ',
  44807. 'ů' => 'Ů',
  44808. 'ű' => 'Ű',
  44809. 'ų' => 'Ų',
  44810. 'ŵ' => 'Ŵ',
  44811. 'ŷ' => 'Ŷ',
  44812. 'ź' => 'Ź',
  44813. 'ż' => 'Ż',
  44814. 'ž' => 'Ž',
  44815. 'Å¿' => 'S',
  44816. 'ƀ' => 'Ƀ',
  44817. 'ƃ' => 'Ƃ',
  44818. 'Æ…' => 'Æ„',
  44819. 'ƈ' => 'Ƈ',
  44820. 'ƌ' => 'Ƌ',
  44821. 'Æ’' => 'Æ‘',
  44822. 'ƕ' => 'Ƕ',
  44823. 'ƙ' => 'Ƙ',
  44824. 'ƚ' => 'Ƚ',
  44825. 'Æž' => 'È ',
  44826. 'Æ¡' => 'Æ ',
  44827. 'Æ£' => 'Æ¢',
  44828. 'ƥ' => 'Ƥ',
  44829. 'ƨ' => 'Ƨ',
  44830. 'ƭ' => 'Ƭ',
  44831. 'ư' => 'Ư',
  44832. 'ƴ' => 'Ƴ',
  44833. 'ƶ' => 'Ƶ',
  44834. 'ƹ' => 'Ƹ',
  44835. 'ƽ' => 'Ƽ',
  44836. 'Æ¿' => 'Ç·',
  44837. 'Ç…' => 'Ç„',
  44838. 'dž' => 'DŽ',
  44839. 'Lj' => 'LJ',
  44840. 'lj' => 'LJ',
  44841. 'Ç‹' => 'ÇŠ',
  44842. 'nj' => 'NJ',
  44843. 'ǎ' => '�',
  44844. '�' => '�',
  44845. 'Ç’' => 'Ç‘',
  44846. 'Ç”' => 'Ç“',
  44847. 'Ç–' => 'Ç•',
  44848. 'ǘ' => 'Ǘ',
  44849. 'Çš' => 'Ç™',
  44850. 'ǜ' => 'Ǜ',
  44851. '�' => 'Ǝ',
  44852. 'ÇŸ' => 'Çž',
  44853. 'Ç¡' => 'Ç ',
  44854. 'Ç£' => 'Ç¢',
  44855. 'ǥ' => 'Ǥ',
  44856. 'ǧ' => 'Ǧ',
  44857. 'ǩ' => 'Ǩ',
  44858. 'ǫ' => 'Ǫ',
  44859. 'ǭ' => 'Ǭ',
  44860. 'ǯ' => 'Ǯ',
  44861. 'Dz' => 'DZ',
  44862. 'dz' => 'DZ',
  44863. 'ǵ' => 'Ǵ',
  44864. 'ǹ' => 'Ǹ',
  44865. 'ǻ' => 'Ǻ',
  44866. 'ǽ' => 'Ǽ',
  44867. 'ǿ' => 'Ǿ',
  44868. '�' => 'Ȁ',
  44869. 'ȃ' => 'Ȃ',
  44870. 'È…' => 'È„',
  44871. 'ȇ' => 'Ȇ',
  44872. 'ȉ' => 'Ȉ',
  44873. 'È‹' => 'ÈŠ',
  44874. '�' => 'Ȍ',
  44875. '�' => 'Ȏ',
  44876. 'ȑ' => '�',
  44877. 'È“' => 'È’',
  44878. 'È•' => 'È”',
  44879. 'È—' => 'È–',
  44880. 'ș' => 'Ș',
  44881. 'È›' => 'Èš',
  44882. '�' => 'Ȝ',
  44883. 'ÈŸ' => 'Èž',
  44884. 'È£' => 'È¢',
  44885. 'ȥ' => 'Ȥ',
  44886. 'ȧ' => 'Ȧ',
  44887. 'ȩ' => 'Ȩ',
  44888. 'ȫ' => 'Ȫ',
  44889. 'ȭ' => 'Ȭ',
  44890. 'ȯ' => 'Ȯ',
  44891. 'ȱ' => 'Ȱ',
  44892. 'ȳ' => 'Ȳ',
  44893. 'ȼ' => 'Ȼ',
  44894. 'È¿' => 'â±¾',
  44895. 'ɀ' => 'Ɀ',
  44896. 'ɂ' => '�',
  44897. 'ɇ' => 'Ɇ',
  44898. 'ɉ' => 'Ɉ',
  44899. 'É‹' => 'ÉŠ',
  44900. '�' => 'Ɍ',
  44901. '�' => 'Ɏ',
  44902. '�' => 'Ɐ',
  44903. 'É‘' => 'â±­',
  44904. 'É’' => 'â±°',
  44905. 'ɓ' => '�',
  44906. 'ɔ' => 'Ɔ',
  44907. 'ɖ' => 'Ɖ',
  44908. 'É—' => 'ÆŠ',
  44909. 'ə' => '�',
  44910. 'ɛ' => '�',
  44911. 'ɜ' => 'Ɜ',
  44912. 'É ' => 'Æ“',
  44913. 'ɡ' => 'Ɡ',
  44914. 'É£' => 'Æ”',
  44915. 'ɥ' => '�',
  44916. 'ɦ' => 'Ɦ',
  44917. 'ɨ' => 'Ɨ',
  44918. 'É©' => 'Æ–',
  44919. 'É«' => 'â±¢',
  44920. 'ɬ' => 'Ɬ',
  44921. 'ɯ' => 'Ɯ',
  44922. 'ɱ' => 'Ɱ',
  44923. 'ɲ' => '�',
  44924. 'ɵ' => 'Ɵ',
  44925. 'ɽ' => 'Ɽ',
  44926. 'ʀ' => 'Ʀ',
  44927. 'ʃ' => 'Ʃ',
  44928. 'ʇ' => 'Ʇ',
  44929. 'ʈ' => 'Ʈ',
  44930. 'ʉ' => 'Ʉ',
  44931. 'ʊ' => 'Ʊ',
  44932. 'ʋ' => 'Ʋ',
  44933. 'ʌ' => 'Ʌ',
  44934. 'Ê’' => 'Æ·',
  44935. 'Êž' => 'êž°',
  44936. 'ͅ' => 'Ι',
  44937. 'ͱ' => 'Ͱ',
  44938. 'ͳ' => 'Ͳ',
  44939. 'ͷ' => 'Ͷ',
  44940. 'ͻ' => 'Ͻ',
  44941. 'ͼ' => 'Ͼ',
  44942. 'ͽ' => 'Ͽ',
  44943. 'ά' => 'Ά',
  44944. 'έ' => 'Έ',
  44945. 'ή' => 'Ή',
  44946. 'ί' => 'Ί',
  44947. 'α' => 'Α',
  44948. 'β' => 'Β',
  44949. 'γ' => 'Γ',
  44950. 'δ' => 'Δ',
  44951. 'ε' => 'Ε',
  44952. 'ζ' => 'Ζ',
  44953. 'η' => 'Η',
  44954. 'θ' => 'Θ',
  44955. 'ι' => 'Ι',
  44956. 'κ' => 'Κ',
  44957. 'λ' => 'Λ',
  44958. 'μ' => 'Μ',
  44959. 'ν' => '�',
  44960. 'ξ' => 'Ξ',
  44961. 'ο' => 'Ο',
  44962. 'π' => 'Π',
  44963. '�' => 'Ρ',
  44964. 'ς' => 'Σ',
  44965. 'σ' => 'Σ',
  44966. 'τ' => 'Τ',
  44967. 'Ï…' => 'Î¥',
  44968. 'φ' => 'Φ',
  44969. 'χ' => 'Χ',
  44970. 'ψ' => 'Ψ',
  44971. 'ω' => 'Ω',
  44972. 'ϊ' => 'Ϊ',
  44973. 'ϋ' => 'Ϋ',
  44974. 'ό' => 'Ό',
  44975. '�' => 'Ύ',
  44976. 'ώ' => '�',
  44977. '�' => 'Β',
  44978. 'ϑ' => 'Θ',
  44979. 'ϕ' => 'Φ',
  44980. 'ϖ' => 'Π',
  44981. 'ϗ' => '�',
  44982. 'ϙ' => 'Ϙ',
  44983. 'Ï›' => 'Ïš',
  44984. '�' => 'Ϝ',
  44985. 'ÏŸ' => 'Ïž',
  44986. 'Ï¡' => 'Ï ',
  44987. 'Ï£' => 'Ï¢',
  44988. 'ϥ' => 'Ϥ',
  44989. 'ϧ' => 'Ϧ',
  44990. 'ϩ' => 'Ϩ',
  44991. 'ϫ' => 'Ϫ',
  44992. 'ϭ' => 'Ϭ',
  44993. 'ϯ' => 'Ϯ',
  44994. 'ϰ' => 'Κ',
  44995. 'ϱ' => 'Ρ',
  44996. 'ϲ' => 'Ϲ',
  44997. 'ϳ' => 'Ϳ',
  44998. 'ϵ' => 'Ε',
  44999. 'ϸ' => 'Ϸ',
  45000. 'ϻ' => 'Ϻ',
  45001. 'а' => '�',
  45002. 'б' => 'Б',
  45003. 'в' => 'В',
  45004. 'г' => 'Г',
  45005. 'д' => 'Д',
  45006. 'е' => 'Е',
  45007. 'ж' => 'Ж',
  45008. 'з' => 'З',
  45009. 'и' => 'И',
  45010. 'й' => 'Й',
  45011. 'к' => 'К',
  45012. 'л' => 'Л',
  45013. 'м' => 'М',
  45014. 'н' => '�',
  45015. 'о' => 'О',
  45016. 'п' => 'П',
  45017. 'р' => 'Р',
  45018. '�' => 'С',
  45019. 'т' => 'Т',
  45020. 'у' => 'У',
  45021. 'ф' => 'Ф',
  45022. 'Ñ…' => 'Ð¥',
  45023. 'ц' => 'Ц',
  45024. 'ч' => 'Ч',
  45025. 'ш' => 'Ш',
  45026. 'щ' => 'Щ',
  45027. 'ъ' => 'Ъ',
  45028. 'ы' => 'Ы',
  45029. 'ь' => 'Ь',
  45030. '�' => 'Э',
  45031. 'ю' => 'Ю',
  45032. '�' => 'Я',
  45033. '�' => 'Ѐ',
  45034. 'ё' => '�',
  45035. 'ђ' => 'Ђ',
  45036. 'ѓ' => 'Ѓ',
  45037. 'є' => 'Є',
  45038. 'Ñ•' => 'Ð…',
  45039. 'і' => 'І',
  45040. 'ї' => 'Ї',
  45041. 'ј' => 'Ј',
  45042. 'љ' => 'Љ',
  45043. 'њ' => 'Њ',
  45044. 'ћ' => 'Ћ',
  45045. 'ќ' => 'Ќ',
  45046. '�' => '�',
  45047. 'Ñž' => 'ÐŽ',
  45048. 'џ' => '�',
  45049. 'Ñ¡' => 'Ñ ',
  45050. 'Ñ£' => 'Ñ¢',
  45051. 'ѥ' => 'Ѥ',
  45052. 'ѧ' => 'Ѧ',
  45053. 'ѩ' => 'Ѩ',
  45054. 'ѫ' => 'Ѫ',
  45055. 'ѭ' => 'Ѭ',
  45056. 'ѯ' => 'Ѯ',
  45057. 'ѱ' => 'Ѱ',
  45058. 'ѳ' => 'Ѳ',
  45059. 'ѵ' => 'Ѵ',
  45060. 'ѷ' => 'Ѷ',
  45061. 'ѹ' => 'Ѹ',
  45062. 'ѻ' => 'Ѻ',
  45063. 'ѽ' => 'Ѽ',
  45064. 'ѿ' => 'Ѿ',
  45065. 'Ò�' => 'Ò€',
  45066. 'Ò‹' => 'ÒŠ',
  45067. '�' => 'Ҍ',
  45068. 'Ò�' => 'ÒŽ',
  45069. 'Ò‘' => 'Ò�',
  45070. 'Ò“' => 'Ò’',
  45071. 'Ò•' => 'Ò”',
  45072. 'Ò—' => 'Ò–',
  45073. 'Ò™' => 'Ò˜',
  45074. 'Ò›' => 'Òš',
  45075. '�' => 'Ҝ',
  45076. 'ÒŸ' => 'Òž',
  45077. 'Ò¡' => 'Ò ',
  45078. 'Ò£' => 'Ò¢',
  45079. 'Ò¥' => 'Ò¤',
  45080. 'Ò§' => 'Ò¦',
  45081. 'Ò©' => 'Ò¨',
  45082. 'Ò«' => 'Òª',
  45083. 'Ò­' => 'Ò¬',
  45084. 'Ò¯' => 'Ò®',
  45085. 'Ò±' => 'Ò°',
  45086. 'Ò³' => 'Ò²',
  45087. 'Òµ' => 'Ò´',
  45088. 'Ò·' => 'Ò¶',
  45089. 'Ò¹' => 'Ò¸',
  45090. 'Ò»' => 'Òº',
  45091. 'Ò½' => 'Ò¼',
  45092. 'Ò¿' => 'Ò¾',
  45093. 'Ó‚' => 'Ó�',
  45094. 'Ó„' => 'Óƒ',
  45095. 'Ó†' => 'Ó…',
  45096. 'Óˆ' => 'Ó‡',
  45097. 'ÓŠ' => 'Ó‰',
  45098. 'ӌ' => 'Ӌ',
  45099. 'ÓŽ' => 'Ó�',
  45100. 'Ó�' => 'Ó€',
  45101. 'Ó‘' => 'Ó�',
  45102. 'Ó“' => 'Ó’',
  45103. 'Ó•' => 'Ó”',
  45104. 'Ó—' => 'Ó–',
  45105. 'Ó™' => 'Ó˜',
  45106. 'Ó›' => 'Óš',
  45107. '�' => 'Ӝ',
  45108. 'ÓŸ' => 'Óž',
  45109. 'Ó¡' => 'Ó ',
  45110. 'Ó£' => 'Ó¢',
  45111. 'Ó¥' => 'Ó¤',
  45112. 'Ó§' => 'Ó¦',
  45113. 'Ó©' => 'Ó¨',
  45114. 'Ó«' => 'Óª',
  45115. 'Ó­' => 'Ó¬',
  45116. 'Ó¯' => 'Ó®',
  45117. 'Ó±' => 'Ó°',
  45118. 'Ó³' => 'Ó²',
  45119. 'Óµ' => 'Ó´',
  45120. 'Ó·' => 'Ó¶',
  45121. 'Ó¹' => 'Ó¸',
  45122. 'Ó»' => 'Óº',
  45123. 'Ó½' => 'Ó¼',
  45124. 'Ó¿' => 'Ó¾',
  45125. 'Ô�' => 'Ô€',
  45126. 'Ôƒ' => 'Ô‚',
  45127. 'Ô…' => 'Ô„',
  45128. 'Ô‡' => 'Ô†',
  45129. 'Ô‰' => 'Ôˆ',
  45130. 'Ô‹' => 'ÔŠ',
  45131. '�' => 'Ԍ',
  45132. 'Ô�' => 'ÔŽ',
  45133. 'Ô‘' => 'Ô�',
  45134. 'Ô“' => 'Ô’',
  45135. 'Ô•' => 'Ô”',
  45136. 'Ô—' => 'Ô–',
  45137. 'Ô™' => 'Ô˜',
  45138. 'Ô›' => 'Ôš',
  45139. '�' => 'Ԝ',
  45140. 'ÔŸ' => 'Ôž',
  45141. 'Ô¡' => 'Ô ',
  45142. 'Ô£' => 'Ô¢',
  45143. 'Ô¥' => 'Ô¤',
  45144. 'Ô§' => 'Ô¦',
  45145. 'Ô©' => 'Ô¨',
  45146. 'Ô«' => 'Ôª',
  45147. 'Ô­' => 'Ô¬',
  45148. 'Ô¯' => 'Ô®',
  45149. 'Õ¡' => 'Ô±',
  45150. 'Õ¢' => 'Ô²',
  45151. 'Õ£' => 'Ô³',
  45152. 'Õ¤' => 'Ô´',
  45153. 'Õ¥' => 'Ôµ',
  45154. 'Õ¦' => 'Ô¶',
  45155. 'Õ§' => 'Ô·',
  45156. 'Õ¨' => 'Ô¸',
  45157. 'Õ©' => 'Ô¹',
  45158. 'Õª' => 'Ôº',
  45159. 'Õ«' => 'Ô»',
  45160. 'Õ¬' => 'Ô¼',
  45161. 'Õ­' => 'Ô½',
  45162. 'Õ®' => 'Ô¾',
  45163. 'Õ¯' => 'Ô¿',
  45164. 'Õ°' => 'Õ€',
  45165. 'Õ±' => 'Õ�',
  45166. 'Õ²' => 'Õ‚',
  45167. 'Õ³' => 'Õƒ',
  45168. 'Õ´' => 'Õ„',
  45169. 'Õµ' => 'Õ…',
  45170. 'Õ¶' => 'Õ†',
  45171. 'Õ·' => 'Õ‡',
  45172. 'Õ¸' => 'Õˆ',
  45173. 'Õ¹' => 'Õ‰',
  45174. 'Õº' => 'ÕŠ',
  45175. 'Õ»' => 'Õ‹',
  45176. 'ռ' => 'Ռ',
  45177. 'Õ½' => 'Õ�',
  45178. 'Õ¾' => 'ÕŽ',
  45179. 'Õ¿' => 'Õ�',
  45180. 'Ö€' => 'Õ�',
  45181. 'Ö�' => 'Õ‘',
  45182. 'Ö‚' => 'Õ’',
  45183. 'Öƒ' => 'Õ“',
  45184. 'Ö„' => 'Õ”',
  45185. 'Ö…' => 'Õ•',
  45186. 'Ö†' => 'Õ–',
  45187. 'ᵹ' => '�',
  45188. 'áµ½' => 'â±£',
  45189. '�' => 'Ḁ',
  45190. 'ḃ' => 'Ḃ',
  45191. 'ḅ' => 'Ḅ',
  45192. 'ḇ' => 'Ḇ',
  45193. 'ḉ' => 'Ḉ',
  45194. 'ḋ' => 'Ḋ',
  45195. '�' => 'Ḍ',
  45196. '�' => 'Ḏ',
  45197. 'ḑ' => '�',
  45198. 'ḓ' => 'Ḓ',
  45199. 'ḕ' => 'Ḕ',
  45200. 'ḗ' => 'Ḗ',
  45201. 'ḙ' => 'Ḙ',
  45202. 'ḛ' => 'Ḛ',
  45203. '�' => 'Ḝ',
  45204. 'ḟ' => 'Ḟ',
  45205. 'ḡ' => 'Ḡ',
  45206. 'ḣ' => 'Ḣ',
  45207. 'ḥ' => 'Ḥ',
  45208. 'ḧ' => 'Ḧ',
  45209. 'ḩ' => 'Ḩ',
  45210. 'ḫ' => 'Ḫ',
  45211. 'ḭ' => 'Ḭ',
  45212. 'ḯ' => 'Ḯ',
  45213. 'ḱ' => 'Ḱ',
  45214. 'ḳ' => 'Ḳ',
  45215. 'ḵ' => 'Ḵ',
  45216. 'ḷ' => 'Ḷ',
  45217. 'ḹ' => 'Ḹ',
  45218. 'ḻ' => 'Ḻ',
  45219. 'ḽ' => 'Ḽ',
  45220. 'ḿ' => 'Ḿ',
  45221. '�' => 'Ṁ',
  45222. 'ṃ' => 'Ṃ',
  45223. 'ṅ' => 'Ṅ',
  45224. 'ṇ' => 'Ṇ',
  45225. 'ṉ' => 'Ṉ',
  45226. 'ṋ' => 'Ṋ',
  45227. '�' => 'Ṍ',
  45228. '�' => 'Ṏ',
  45229. 'ṑ' => '�',
  45230. 'ṓ' => 'Ṓ',
  45231. 'ṕ' => 'Ṕ',
  45232. 'á¹—' => 'á¹–',
  45233. 'ṙ' => 'Ṙ',
  45234. 'ṛ' => 'Ṛ',
  45235. '�' => 'Ṝ',
  45236. 'ṟ' => 'Ṟ',
  45237. 'ṡ' => 'Ṡ',
  45238. 'á¹£' => 'á¹¢',
  45239. 'ṥ' => 'Ṥ',
  45240. 'ṧ' => 'Ṧ',
  45241. 'ṩ' => 'Ṩ',
  45242. 'ṫ' => 'Ṫ',
  45243. 'ṭ' => 'Ṭ',
  45244. 'ṯ' => 'Ṯ',
  45245. 'á¹±' => 'á¹°',
  45246. 'á¹³' => 'á¹²',
  45247. 'á¹µ' => 'á¹´',
  45248. 'ṷ' => 'Ṷ',
  45249. 'ṹ' => 'Ṹ',
  45250. 'ṻ' => 'Ṻ',
  45251. 'á¹½' => 'á¹¼',
  45252. 'ṿ' => 'Ṿ',
  45253. '�' => 'Ẁ',
  45254. 'ẃ' => 'Ẃ',
  45255. 'ẅ' => 'Ẅ',
  45256. 'ẇ' => 'Ẇ',
  45257. 'ẉ' => 'Ẉ',
  45258. 'ẋ' => 'Ẋ',
  45259. '�' => 'Ẍ',
  45260. '�' => 'Ẏ',
  45261. 'ẑ' => '�',
  45262. 'ẓ' => 'Ẓ',
  45263. 'ẕ' => 'Ẕ',
  45264. 'ẛ' => 'Ṡ',
  45265. 'ạ' => 'Ạ',
  45266. 'ả' => 'Ả',
  45267. 'ấ' => 'Ấ',
  45268. 'ầ' => 'Ầ',
  45269. 'ẩ' => 'Ẩ',
  45270. 'ẫ' => 'Ẫ',
  45271. 'ậ' => 'Ậ',
  45272. 'ắ' => 'Ắ',
  45273. 'ằ' => 'Ằ',
  45274. 'ẳ' => 'Ẳ',
  45275. 'ẵ' => 'Ẵ',
  45276. 'ặ' => 'Ặ',
  45277. 'ẹ' => 'Ẹ',
  45278. 'ẻ' => 'Ẻ',
  45279. 'ẽ' => 'Ẽ',
  45280. 'ế' => 'Ế',
  45281. '�' => 'Ề',
  45282. 'ể' => 'Ể',
  45283. 'ễ' => 'Ễ',
  45284. 'ệ' => 'Ệ',
  45285. 'ỉ' => 'Ỉ',
  45286. 'ị' => 'Ị',
  45287. '�' => 'Ọ',
  45288. '�' => 'Ỏ',
  45289. 'ố' => '�',
  45290. 'ồ' => 'Ồ',
  45291. 'ổ' => 'Ổ',
  45292. 'á»—' => 'á»–',
  45293. 'ộ' => 'Ộ',
  45294. 'ớ' => 'Ớ',
  45295. '�' => 'Ờ',
  45296. 'ở' => 'Ở',
  45297. 'ỡ' => 'Ỡ',
  45298. 'ợ' => 'Ợ',
  45299. 'ụ' => 'Ụ',
  45300. 'ủ' => 'Ủ',
  45301. 'ứ' => 'Ứ',
  45302. 'ừ' => 'Ừ',
  45303. 'ử' => 'Ử',
  45304. 'ữ' => 'Ữ',
  45305. 'á»±' => 'á»°',
  45306. 'ỳ' => 'Ỳ',
  45307. 'ỵ' => 'Ỵ',
  45308. 'ỷ' => 'Ỷ',
  45309. 'ỹ' => 'Ỹ',
  45310. 'ỻ' => 'Ỻ',
  45311. 'ỽ' => 'Ỽ',
  45312. 'ỿ' => 'Ỿ',
  45313. 'ἀ' => 'Ἀ',
  45314. '�' => 'Ἁ',
  45315. 'ἂ' => 'Ἂ',
  45316. 'ἃ' => 'Ἃ',
  45317. 'ἄ' => 'Ἄ',
  45318. 'ἅ' => '�',
  45319. 'ἆ' => 'Ἆ',
  45320. 'ἇ' => '�',
  45321. '�' => 'Ἐ',
  45322. 'ἑ' => 'Ἑ',
  45323. 'ἒ' => 'Ἒ',
  45324. 'ἓ' => 'Ἓ',
  45325. 'ἔ' => 'Ἔ',
  45326. 'ἕ' => '�',
  45327. 'ἠ' => 'Ἠ',
  45328. 'ἡ' => 'Ἡ',
  45329. 'ἢ' => 'Ἢ',
  45330. 'ἣ' => 'Ἣ',
  45331. 'ἤ' => 'Ἤ',
  45332. 'á¼¥' => 'á¼­',
  45333. 'ἦ' => 'Ἦ',
  45334. 'ἧ' => 'Ἧ',
  45335. 'ἰ' => 'Ἰ',
  45336. 'á¼±' => 'á¼¹',
  45337. 'ἲ' => 'Ἲ',
  45338. 'á¼³' => 'á¼»',
  45339. 'á¼´' => 'á¼¼',
  45340. 'á¼µ' => 'á¼½',
  45341. 'ἶ' => 'Ἶ',
  45342. 'ἷ' => 'Ἷ',
  45343. 'ὀ' => 'Ὀ',
  45344. '�' => 'Ὁ',
  45345. 'ὂ' => 'Ὂ',
  45346. 'ὃ' => 'Ὃ',
  45347. 'ὄ' => 'Ὄ',
  45348. 'ὅ' => '�',
  45349. 'ὑ' => 'Ὑ',
  45350. 'ὓ' => 'Ὓ',
  45351. 'ὕ' => '�',
  45352. 'ὗ' => 'Ὗ',
  45353. 'ὠ' => 'Ὠ',
  45354. 'ὡ' => 'Ὡ',
  45355. 'ὢ' => 'Ὢ',
  45356. 'ὣ' => 'Ὣ',
  45357. 'ὤ' => 'Ὤ',
  45358. 'á½¥' => 'á½­',
  45359. 'ὦ' => 'Ὦ',
  45360. 'ὧ' => 'Ὧ',
  45361. 'ὰ' => 'Ὰ',
  45362. 'á½±' => 'á¾»',
  45363. 'ὲ' => 'Ὲ',
  45364. 'έ' => 'Έ',
  45365. 'á½´' => 'á¿Š',
  45366. 'á½µ' => 'á¿‹',
  45367. 'ὶ' => 'Ὶ',
  45368. 'á½·' => 'á¿›',
  45369. 'ὸ' => 'Ὸ',
  45370. 'ό' => 'Ό',
  45371. 'ὺ' => 'Ὺ',
  45372. 'á½»' => 'á¿«',
  45373. 'ὼ' => 'Ὼ',
  45374. 'á½½' => 'á¿»',
  45375. 'ᾀ' => 'ᾈ',
  45376. '�' => 'ᾉ',
  45377. 'ᾂ' => 'ᾊ',
  45378. 'ᾃ' => 'ᾋ',
  45379. 'ᾄ' => 'ᾌ',
  45380. 'ᾅ' => '�',
  45381. 'ᾆ' => 'ᾎ',
  45382. 'ᾇ' => '�',
  45383. '�' => 'ᾘ',
  45384. 'ᾑ' => 'ᾙ',
  45385. 'ᾒ' => 'ᾚ',
  45386. 'ᾓ' => 'ᾛ',
  45387. 'ᾔ' => 'ᾜ',
  45388. 'ᾕ' => '�',
  45389. 'ᾖ' => 'ᾞ',
  45390. 'ᾗ' => 'ᾟ',
  45391. 'ᾠ' => 'ᾨ',
  45392. 'ᾡ' => 'ᾩ',
  45393. 'ᾢ' => 'ᾪ',
  45394. 'ᾣ' => 'ᾫ',
  45395. 'ᾤ' => 'ᾬ',
  45396. 'á¾¥' => 'á¾­',
  45397. 'ᾦ' => 'ᾮ',
  45398. 'ᾧ' => 'ᾯ',
  45399. 'ᾰ' => 'Ᾰ',
  45400. 'á¾±' => 'á¾¹',
  45401. 'á¾³' => 'á¾¼',
  45402. 'ι' => 'Ι',
  45403. 'ῃ' => 'ῌ',
  45404. '�' => 'Ῐ',
  45405. 'á¿‘' => 'á¿™',
  45406. 'ῠ' => 'Ῠ',
  45407. 'á¿¡' => 'á¿©',
  45408. 'ῥ' => 'Ῥ',
  45409. 'ῳ' => 'ῼ',
  45410. 'ⅎ' => 'Ⅎ',
  45411. 'â…°' => 'â… ',
  45412. 'â…±' => 'â…¡',
  45413. 'â…²' => 'â…¢',
  45414. 'â…³' => 'â…£',
  45415. 'â…´' => 'â…¤',
  45416. 'â…µ' => 'â…¥',
  45417. 'â…¶' => 'â…¦',
  45418. 'â…·' => 'â…§',
  45419. 'â…¸' => 'â…¨',
  45420. 'â…¹' => 'â…©',
  45421. 'â…º' => 'â…ª',
  45422. 'â…»' => 'â…«',
  45423. 'â…¼' => 'â…¬',
  45424. 'â…½' => 'â…­',
  45425. 'â…¾' => 'â…®',
  45426. 'â…¿' => 'â…¯',
  45427. 'ↄ' => 'Ↄ',
  45428. '�' => 'Ⓐ',
  45429. 'â“‘' => 'â’·',
  45430. 'â“’' => 'â’¸',
  45431. 'â““' => 'â’¹',
  45432. 'â“”' => 'â’º',
  45433. 'â“•' => 'â’»',
  45434. 'â“–' => 'â’¼',
  45435. 'â“—' => 'â’½',
  45436. 'ⓘ' => 'Ⓘ',
  45437. 'â“™' => 'â’¿',
  45438. 'â“š' => 'â“€',
  45439. 'ⓛ' => '�',
  45440. 'ⓜ' => 'Ⓜ',
  45441. '�' => 'Ⓝ',
  45442. 'â“ž' => 'â“„',
  45443. 'â“Ÿ' => 'â“…',
  45444. 'ⓠ' => 'Ⓠ',
  45445. 'ⓡ' => 'Ⓡ',
  45446. 'ⓢ' => 'Ⓢ',
  45447. 'ⓣ' => 'Ⓣ',
  45448. 'ⓤ' => 'Ⓤ',
  45449. 'â“¥' => 'â“‹',
  45450. 'ⓦ' => 'Ⓦ',
  45451. 'ⓧ' => '�',
  45452. 'ⓨ' => 'Ⓨ',
  45453. 'ⓩ' => '�',
  45454. 'â°°' => 'â°€',
  45455. 'â°±' => 'â°�',
  45456. 'â°²' => 'â°‚',
  45457. 'â°³' => 'â°ƒ',
  45458. 'â°´' => 'â°„',
  45459. 'â°µ' => 'â°…',
  45460. 'â°¶' => 'â°†',
  45461. 'â°·' => 'â°‡',
  45462. 'â°¸' => 'â°ˆ',
  45463. 'â°¹' => 'â°‰',
  45464. 'â°º' => 'â°Š',
  45465. 'â°»' => 'â°‹',
  45466. 'ⰼ' => 'Ⰼ',
  45467. 'â°½' => 'â°�',
  45468. 'â°¾' => 'â°Ž',
  45469. 'â°¿' => 'â°�',
  45470. 'â±€' => 'â°�',
  45471. '�' => 'Ⱁ',
  45472. 'ⱂ' => 'Ⱂ',
  45473. 'ⱃ' => 'Ⱃ',
  45474. 'ⱄ' => 'Ⱄ',
  45475. 'â±…' => 'â°•',
  45476. 'ⱆ' => 'Ⱆ',
  45477. 'ⱇ' => 'Ⱇ',
  45478. 'ⱈ' => 'Ⱈ',
  45479. 'ⱉ' => 'Ⱉ',
  45480. 'ⱊ' => 'Ⱊ',
  45481. 'ⱋ' => 'Ⱋ',
  45482. 'ⱌ' => 'Ⱌ',
  45483. '�' => '�',
  45484. 'ⱎ' => 'Ⱎ',
  45485. '�' => 'Ⱏ',
  45486. '�' => 'Ⱐ',
  45487. 'ⱑ' => 'Ⱑ',
  45488. 'â±’' => 'â°¢',
  45489. 'ⱓ' => 'Ⱓ',
  45490. 'â±”' => 'â°¤',
  45491. 'ⱕ' => 'Ⱕ',
  45492. 'â±–' => 'â°¦',
  45493. 'â±—' => 'â°§',
  45494. 'ⱘ' => 'Ⱘ',
  45495. 'â±™' => 'â°©',
  45496. 'ⱚ' => 'Ⱚ',
  45497. 'â±›' => 'â°«',
  45498. 'ⱜ' => 'Ⱜ',
  45499. '�' => 'Ⱝ',
  45500. 'ⱞ' => 'Ⱞ',
  45501. 'ⱡ' => 'Ⱡ',
  45502. 'ⱥ' => 'Ⱥ',
  45503. 'ⱦ' => 'Ⱦ',
  45504. 'ⱨ' => 'Ⱨ',
  45505. 'ⱪ' => 'Ⱪ',
  45506. 'ⱬ' => 'Ⱬ',
  45507. 'â±³' => 'â±²',
  45508. 'ⱶ' => 'Ⱶ',
  45509. '�' => 'Ⲁ',
  45510. 'ⲃ' => 'Ⲃ',
  45511. 'ⲅ' => 'Ⲅ',
  45512. 'ⲇ' => 'Ⲇ',
  45513. 'ⲉ' => 'Ⲉ',
  45514. 'ⲋ' => 'Ⲋ',
  45515. '�' => 'Ⲍ',
  45516. '�' => 'Ⲏ',
  45517. 'ⲑ' => '�',
  45518. 'ⲓ' => 'Ⲓ',
  45519. 'ⲕ' => 'Ⲕ',
  45520. 'â²—' => 'â²–',
  45521. 'ⲙ' => 'Ⲙ',
  45522. 'ⲛ' => 'Ⲛ',
  45523. '�' => 'Ⲝ',
  45524. 'ⲟ' => 'Ⲟ',
  45525. 'ⲡ' => 'Ⲡ',
  45526. 'â²£' => 'â²¢',
  45527. 'ⲥ' => 'Ⲥ',
  45528. 'ⲧ' => 'Ⲧ',
  45529. 'ⲩ' => 'Ⲩ',
  45530. 'ⲫ' => 'Ⲫ',
  45531. 'ⲭ' => 'Ⲭ',
  45532. 'ⲯ' => 'Ⲯ',
  45533. 'â²±' => 'â²°',
  45534. 'â²³' => 'â²²',
  45535. 'â²µ' => 'â²´',
  45536. 'ⲷ' => 'Ⲷ',
  45537. 'ⲹ' => 'Ⲹ',
  45538. 'ⲻ' => 'Ⲻ',
  45539. 'â²½' => 'â²¼',
  45540. 'ⲿ' => 'Ⲿ',
  45541. '�' => 'Ⳁ',
  45542. 'ⳃ' => 'Ⳃ',
  45543. 'ⳅ' => 'Ⳅ',
  45544. 'ⳇ' => 'Ⳇ',
  45545. 'ⳉ' => 'Ⳉ',
  45546. 'ⳋ' => 'Ⳋ',
  45547. '�' => 'Ⳍ',
  45548. '�' => 'Ⳏ',
  45549. 'ⳑ' => '�',
  45550. 'ⳓ' => 'Ⳓ',
  45551. 'ⳕ' => 'Ⳕ',
  45552. 'â³—' => 'â³–',
  45553. 'ⳙ' => 'Ⳙ',
  45554. 'ⳛ' => 'Ⳛ',
  45555. '�' => 'Ⳝ',
  45556. 'ⳟ' => 'Ⳟ',
  45557. 'ⳡ' => 'Ⳡ',
  45558. 'â³£' => 'â³¢',
  45559. 'ⳬ' => 'Ⳬ',
  45560. 'â³®' => 'â³­',
  45561. 'â³³' => 'â³²',
  45562. 'â´€' => 'á‚ ',
  45563. 'â´�' => 'á‚¡',
  45564. 'â´‚' => 'á‚¢',
  45565. 'â´ƒ' => 'á‚£',
  45566. 'ⴄ' => 'Ⴄ',
  45567. 'â´…' => 'á‚¥',
  45568. 'ⴆ' => 'Ⴆ',
  45569. 'ⴇ' => 'Ⴇ',
  45570. 'ⴈ' => 'Ⴈ',
  45571. 'â´‰' => 'á‚©',
  45572. 'ⴊ' => 'Ⴊ',
  45573. 'â´‹' => 'á‚«',
  45574. 'ⴌ' => 'Ⴌ',
  45575. 'â´�' => 'á‚­',
  45576. 'â´Ž' => 'á‚®',
  45577. '�' => 'Ⴏ',
  45578. 'â´�' => 'á‚°',
  45579. 'ⴑ' => 'Ⴑ',
  45580. 'ⴒ' => 'Ⴒ',
  45581. 'ⴓ' => 'Ⴓ',
  45582. 'â´”' => 'á‚´',
  45583. 'ⴕ' => 'Ⴕ',
  45584. 'ⴖ' => 'Ⴖ',
  45585. 'â´—' => 'á‚·',
  45586. 'ⴘ' => 'Ⴘ',
  45587. 'ⴙ' => 'Ⴙ',
  45588. 'ⴚ' => 'Ⴚ',
  45589. 'â´›' => 'á‚»',
  45590. 'ⴜ' => 'Ⴜ',
  45591. '�' => 'Ⴝ',
  45592. 'ⴞ' => 'Ⴞ',
  45593. 'â´Ÿ' => 'á‚¿',
  45594. 'ⴠ' => 'Ⴠ',
  45595. 'ⴡ' => '�',
  45596. 'ⴢ' => 'Ⴢ',
  45597. 'ⴣ' => 'Ⴣ',
  45598. 'ⴤ' => 'Ⴤ',
  45599. 'ⴥ' => 'Ⴥ',
  45600. 'ⴧ' => 'Ⴧ',
  45601. 'ⴭ' => '�',
  45602. '�' => 'Ꙁ',
  45603. 'ꙃ' => 'Ꙃ',
  45604. 'ꙅ' => 'Ꙅ',
  45605. 'ꙇ' => 'Ꙇ',
  45606. 'ꙉ' => 'Ꙉ',
  45607. 'ꙋ' => 'Ꙋ',
  45608. '�' => 'Ꙍ',
  45609. '�' => 'Ꙏ',
  45610. 'ꙑ' => '�',
  45611. 'ꙓ' => 'Ꙓ',
  45612. 'ꙕ' => 'Ꙕ',
  45613. 'ê™—' => 'ê™–',
  45614. 'ꙙ' => 'Ꙙ',
  45615. 'ꙛ' => 'Ꙛ',
  45616. '�' => 'Ꙝ',
  45617. 'ꙟ' => 'Ꙟ',
  45618. 'ꙡ' => 'Ꙡ',
  45619. 'ꙣ' => 'Ꙣ',
  45620. 'ꙥ' => 'Ꙥ',
  45621. 'ꙧ' => 'Ꙧ',
  45622. 'ꙩ' => 'Ꙩ',
  45623. 'ꙫ' => 'Ꙫ',
  45624. 'ꙭ' => 'Ꙭ',
  45625. '�' => 'Ꚁ',
  45626. 'ꚃ' => 'Ꚃ',
  45627. 'êš…' => 'êš„',
  45628. 'ꚇ' => 'Ꚇ',
  45629. 'ꚉ' => 'Ꚉ',
  45630. 'ꚋ' => 'Ꚋ',
  45631. '�' => 'Ꚍ',
  45632. '�' => 'Ꚏ',
  45633. 'ꚑ' => '�',
  45634. 'êš“' => 'êš’',
  45635. 'êš•' => 'êš”',
  45636. 'êš—' => 'êš–',
  45637. 'ꚙ' => 'Ꚙ',
  45638. 'êš›' => 'êšš',
  45639. 'ꜣ' => 'Ꜣ',
  45640. 'ꜥ' => 'Ꜥ',
  45641. 'ꜧ' => 'Ꜧ',
  45642. 'ꜩ' => 'Ꜩ',
  45643. 'ꜫ' => 'Ꜫ',
  45644. 'ꜭ' => 'Ꜭ',
  45645. 'ꜯ' => 'Ꜯ',
  45646. 'ꜳ' => 'Ꜳ',
  45647. 'ꜵ' => 'Ꜵ',
  45648. 'ꜷ' => 'Ꜷ',
  45649. 'ꜹ' => 'Ꜹ',
  45650. 'ꜻ' => 'Ꜻ',
  45651. 'ꜽ' => 'Ꜽ',
  45652. 'ꜿ' => 'Ꜿ',
  45653. '�' => '�',
  45654. '�' => '�',
  45655. '�' => '�',
  45656. '�' => '�',
  45657. '�' => '�',
  45658. '�' => '�',
  45659. '�' => '�',
  45660. '�' => '�',
  45661. '�' => '�',
  45662. '�' => '�',
  45663. '�' => '�',
  45664. '�' => '�',
  45665. '�' => '�',
  45666. '�' => '�',
  45667. '�' => '�',
  45668. '�' => '�',
  45669. '�' => '�',
  45670. '�' => '�',
  45671. '�' => '�',
  45672. '�' => '�',
  45673. '�' => '�',
  45674. '�' => '�',
  45675. '�' => '�',
  45676. '�' => '�',
  45677. '�' => '�',
  45678. '�' => '�',
  45679. '�' => '�',
  45680. '�' => 'Ꞁ',
  45681. 'ꞃ' => 'Ꞃ',
  45682. 'êž…' => 'êž„',
  45683. 'ꞇ' => 'Ꞇ',
  45684. 'ꞌ' => 'Ꞌ',
  45685. 'ꞑ' => '�',
  45686. 'êž“' => 'êž’',
  45687. 'êž—' => 'êž–',
  45688. 'ꞙ' => 'Ꞙ',
  45689. 'êž›' => 'êžš',
  45690. '�' => 'Ꞝ',
  45691. 'ꞟ' => 'Ꞟ',
  45692. 'êž¡' => 'êž ',
  45693. 'ꞣ' => 'Ꞣ',
  45694. 'ꞥ' => 'Ꞥ',
  45695. 'ꞧ' => 'Ꞧ',
  45696. 'ꞩ' => 'Ꞩ',
  45697. '�' => 'A',
  45698. 'b' => 'B',
  45699. 'c' => 'C',
  45700. 'd' => 'D',
  45701. 'ï½…' => 'ï¼¥',
  45702. 'f' => 'F',
  45703. 'g' => 'G',
  45704. 'h' => 'H',
  45705. 'i' => 'I',
  45706. 'j' => 'J',
  45707. 'k' => 'K',
  45708. 'l' => 'L',
  45709. '�' => 'M',
  45710. 'n' => 'N',
  45711. '�' => 'O',
  45712. '�' => 'P',
  45713. 'q' => 'Q',
  45714. 'ï½’' => 'ï¼²',
  45715. 's' => 'S',
  45716. 'ï½”' => 'ï¼´',
  45717. 'u' => 'U',
  45718. 'v' => 'V',
  45719. 'ï½—' => 'ï¼·',
  45720. 'x' => 'X',
  45721. 'ï½™' => 'ï¼¹',
  45722. 'z' => 'Z',
  45723. '�' => '�',
  45724. '�' => '�',
  45725. '�' => '�',
  45726. '�' => '�',
  45727. '�' => '�',
  45728. '�' => '�',
  45729. '�' => '�',
  45730. '�' => '�',
  45731. '�' => '�',
  45732. '�' => '�',
  45733. '�' => '�',
  45734. '�' => '�',
  45735. '�' => '�',
  45736. '�' => '�',
  45737. '�' => '�',
  45738. '�' => '�',
  45739. '�' => '�',
  45740. '�' => '�',
  45741. '�' => '�',
  45742. '�' => '�',
  45743. '�' => '�',
  45744. '�' => '�',
  45745. '�' => '�',
  45746. '�' => '�',
  45747. '�' => '�',
  45748. '�' => '�',
  45749. '�' => '�',
  45750. '�' => '�',
  45751. '�' => '�',
  45752. '�' => '�',
  45753. '�' => '�',
  45754. '�' => '�',
  45755. '�' => '�',
  45756. '�' => '�',
  45757. '�' => '�',
  45758. '�' => '�',
  45759. '�' => '�',
  45760. '�' => '�',
  45761. '�' => '�',
  45762. '�' => '�',
  45763. 'ð‘£€' => 'ð‘¢ ',
  45764. '�' => '𑢡',
  45765. '𑣂' => '𑢢',
  45766. '𑣃' => '𑢣',
  45767. '𑣄' => '𑢤',
  45768. 'ð‘£…' => 'ð‘¢¥',
  45769. '𑣆' => '𑢦',
  45770. '𑣇' => '𑢧',
  45771. '𑣈' => '𑢨',
  45772. '𑣉' => '𑢩',
  45773. '𑣊' => '𑢪',
  45774. '𑣋' => '𑢫',
  45775. '𑣌' => '𑢬',
  45776. '�' => '𑢭',
  45777. '𑣎' => '𑢮',
  45778. '�' => '𑢯',
  45779. '�' => '𑢰',
  45780. '𑣑' => '𑢱',
  45781. 'ð‘£’' => 'ð‘¢²',
  45782. '𑣓' => '𑢳',
  45783. 'ð‘£”' => 'ð‘¢´',
  45784. '𑣕' => '𑢵',
  45785. '𑣖' => '𑢶',
  45786. 'ð‘£—' => 'ð‘¢·',
  45787. '𑣘' => '𑢸',
  45788. 'ð‘£™' => 'ð‘¢¹',
  45789. '𑣚' => '𑢺',
  45790. 'ð‘£›' => 'ð‘¢»',
  45791. '𑣜' => '𑢼',
  45792. '�' => '𑢽',
  45793. '𑣞' => '𑢾',
  45794. '𑣟' => '𑢿',
  45795. );
  45796. <?php
  45797. use Symfony\Polyfill\Mbstring as p;
  45798. if (!function_exists('mb_strlen')) {
  45799. define('MB_CASE_UPPER', 0);
  45800. define('MB_CASE_LOWER', 1);
  45801. define('MB_CASE_TITLE', 2);
  45802. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  45803. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  45804. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  45805. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  45806. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  45807. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  45808. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  45809. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  45810. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  45811. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  45812. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  45813. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  45814. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  45815. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  45816. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  45817. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  45818. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  45819. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  45820. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  45821. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  45822. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  45823. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  45824. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  45825. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  45826. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  45827. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  45828. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  45829. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  45830. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  45831. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  45832. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  45833. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  45834. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  45835. 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); }
  45836. }
  45837. if (!function_exists('mb_chr')) {
  45838. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  45839. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  45840. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  45841. }
  45842. <?php
  45843. namespace Symfony\Component\Process\Exception;
  45844. interface ExceptionInterface
  45845. {
  45846. }
  45847. <?php
  45848. namespace Symfony\Component\Process\Exception;
  45849. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45850. {
  45851. }
  45852. <?php
  45853. namespace Symfony\Component\Process\Exception;
  45854. class LogicException extends \LogicException implements ExceptionInterface
  45855. {
  45856. }
  45857. <?php
  45858. namespace Symfony\Component\Process\Exception;
  45859. use Symfony\Component\Process\Process;
  45860. class ProcessFailedException extends RuntimeException
  45861. {
  45862. private $process;
  45863. public function __construct(Process $process)
  45864. {
  45865. if ($process->isSuccessful()) {
  45866. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  45867. }
  45868. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  45869. $process->getCommandLine(),
  45870. $process->getExitCode(),
  45871. $process->getExitCodeText(),
  45872. $process->getWorkingDirectory()
  45873. );
  45874. if (!$process->isOutputDisabled()) {
  45875. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  45876. $process->getOutput(),
  45877. $process->getErrorOutput()
  45878. );
  45879. }
  45880. parent::__construct($error);
  45881. $this->process = $process;
  45882. }
  45883. public function getProcess()
  45884. {
  45885. return $this->process;
  45886. }
  45887. }
  45888. <?php
  45889. namespace Symfony\Component\Process\Exception;
  45890. use Symfony\Component\Process\Process;
  45891. class ProcessTimedOutException extends RuntimeException
  45892. {
  45893. const TYPE_GENERAL = 1;
  45894. const TYPE_IDLE = 2;
  45895. private $process;
  45896. private $timeoutType;
  45897. public function __construct(Process $process, $timeoutType)
  45898. {
  45899. $this->process = $process;
  45900. $this->timeoutType = $timeoutType;
  45901. parent::__construct(sprintf(
  45902. 'The process "%s" exceeded the timeout of %s seconds.',
  45903. $process->getCommandLine(),
  45904. $this->getExceededTimeout()
  45905. ));
  45906. }
  45907. public function getProcess()
  45908. {
  45909. return $this->process;
  45910. }
  45911. public function isGeneralTimeout()
  45912. {
  45913. return self::TYPE_GENERAL === $this->timeoutType;
  45914. }
  45915. public function isIdleTimeout()
  45916. {
  45917. return self::TYPE_IDLE === $this->timeoutType;
  45918. }
  45919. public function getExceededTimeout()
  45920. {
  45921. switch ($this->timeoutType) {
  45922. case self::TYPE_GENERAL:
  45923. return $this->process->getTimeout();
  45924. case self::TYPE_IDLE:
  45925. return $this->process->getIdleTimeout();
  45926. default:
  45927. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  45928. }
  45929. }
  45930. }
  45931. <?php
  45932. namespace Symfony\Component\Process\Exception;
  45933. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45934. {
  45935. }
  45936. <?php
  45937. namespace Symfony\Component\Process;
  45938. class ExecutableFinder
  45939. {
  45940. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  45941. public function setSuffixes(array $suffixes)
  45942. {
  45943. $this->suffixes = $suffixes;
  45944. }
  45945. public function addSuffix($suffix)
  45946. {
  45947. $this->suffixes[] = $suffix;
  45948. }
  45949. public function find($name, $default = null, array $extraDirs = array())
  45950. {
  45951. if (ini_get('open_basedir')) {
  45952. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  45953. $dirs = array();
  45954. foreach ($searchPath as $path) {
  45955. if (@is_dir($path)) {
  45956. $dirs[] = $path;
  45957. } else {
  45958. if (basename($path) == $name && @is_executable($path)) {
  45959. return $path;
  45960. }
  45961. }
  45962. }
  45963. } else {
  45964. $dirs = array_merge(
  45965. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  45966. $extraDirs
  45967. );
  45968. }
  45969. $suffixes = array('');
  45970. if ('\\' === \DIRECTORY_SEPARATOR) {
  45971. $pathExt = getenv('PATHEXT');
  45972. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  45973. }
  45974. foreach ($suffixes as $suffix) {
  45975. foreach ($dirs as $dir) {
  45976. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  45977. return $file;
  45978. }
  45979. }
  45980. }
  45981. return $default;
  45982. }
  45983. }
  45984. Copyright (c) 2004-2018 Fabien Potencier
  45985. Permission is hereby granted, free of charge, to any person obtaining a copy
  45986. of this software and associated documentation files (the "Software"), to deal
  45987. in the Software without restriction, including without limitation the rights
  45988. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45989. copies of the Software, and to permit persons to whom the Software is furnished
  45990. to do so, subject to the following conditions:
  45991. The above copyright notice and this permission notice shall be included in all
  45992. copies or substantial portions of the Software.
  45993. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45994. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45995. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45996. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45997. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45998. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45999. THE SOFTWARE.
  46000. <?php
  46001. namespace Symfony\Component\Process;
  46002. class PhpExecutableFinder
  46003. {
  46004. private $executableFinder;
  46005. public function __construct()
  46006. {
  46007. $this->executableFinder = new ExecutableFinder();
  46008. }
  46009. public function find($includeArgs = true)
  46010. {
  46011. $args = $this->findArguments();
  46012. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  46013. if (\defined('HHVM_VERSION')) {
  46014. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  46015. }
  46016. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  46017. return PHP_BINARY.$args;
  46018. }
  46019. if ($php = getenv('PHP_PATH')) {
  46020. if (!@is_executable($php)) {
  46021. return false;
  46022. }
  46023. return $php;
  46024. }
  46025. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  46026. if (@is_executable($php)) {
  46027. return $php;
  46028. }
  46029. }
  46030. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  46031. return $php;
  46032. }
  46033. $dirs = array(PHP_BINDIR);
  46034. if ('\\' === \DIRECTORY_SEPARATOR) {
  46035. $dirs[] = 'C:\xampp\php\\';
  46036. }
  46037. return $this->executableFinder->find('php', false, $dirs);
  46038. }
  46039. public function findArguments()
  46040. {
  46041. $arguments = array();
  46042. if (\defined('HHVM_VERSION')) {
  46043. $arguments[] = '--php';
  46044. } elseif ('phpdbg' === \PHP_SAPI) {
  46045. $arguments[] = '-qrr';
  46046. }
  46047. return $arguments;
  46048. }
  46049. }
  46050. <?php
  46051. namespace Symfony\Component\Process;
  46052. use Symfony\Component\Process\Exception\RuntimeException;
  46053. class PhpProcess extends Process
  46054. {
  46055. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  46056. {
  46057. $executableFinder = new PhpExecutableFinder();
  46058. if (false === $php = $executableFinder->find()) {
  46059. $php = null;
  46060. }
  46061. if ('phpdbg' === \PHP_SAPI) {
  46062. $file = tempnam(sys_get_temp_dir(), 'dbg');
  46063. file_put_contents($file, $script);
  46064. register_shutdown_function('unlink', $file);
  46065. $php .= ' '.ProcessUtils::escapeArgument($file);
  46066. $script = null;
  46067. }
  46068. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  46069. $php = 'exec '.$php;
  46070. }
  46071. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  46072. }
  46073. public function setPhpBinary($php)
  46074. {
  46075. $this->setCommandLine($php);
  46076. }
  46077. public function start($callback = null)
  46078. {
  46079. if (null === $this->getCommandLine()) {
  46080. throw new RuntimeException('Unable to find the PHP executable.');
  46081. }
  46082. parent::start($callback);
  46083. }
  46084. }
  46085. <?php
  46086. namespace Symfony\Component\Process\Pipes;
  46087. abstract class AbstractPipes implements PipesInterface
  46088. {
  46089. public $pipes = array();
  46090. private $inputBuffer = '';
  46091. private $input;
  46092. private $blocked = true;
  46093. private $lastError;
  46094. public function __construct($input)
  46095. {
  46096. if (\is_resource($input)) {
  46097. $this->input = $input;
  46098. } elseif (\is_string($input)) {
  46099. $this->inputBuffer = $input;
  46100. } else {
  46101. $this->inputBuffer = (string) $input;
  46102. }
  46103. }
  46104. public function close()
  46105. {
  46106. foreach ($this->pipes as $pipe) {
  46107. fclose($pipe);
  46108. }
  46109. $this->pipes = array();
  46110. }
  46111. protected function hasSystemCallBeenInterrupted()
  46112. {
  46113. $lastError = $this->lastError;
  46114. $this->lastError = null;
  46115. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  46116. }
  46117. protected function unblock()
  46118. {
  46119. if (!$this->blocked) {
  46120. return;
  46121. }
  46122. foreach ($this->pipes as $pipe) {
  46123. stream_set_blocking($pipe, 0);
  46124. }
  46125. if (null !== $this->input) {
  46126. stream_set_blocking($this->input, 0);
  46127. }
  46128. $this->blocked = false;
  46129. }
  46130. protected function write()
  46131. {
  46132. if (!isset($this->pipes[0])) {
  46133. return;
  46134. }
  46135. $input = $this->input;
  46136. $r = $e = array();
  46137. $w = array($this->pipes[0]);
  46138. if (false === @stream_select($r, $w, $e, 0, 0)) {
  46139. return;
  46140. }
  46141. foreach ($w as $stdin) {
  46142. if (isset($this->inputBuffer[0])) {
  46143. $written = fwrite($stdin, $this->inputBuffer);
  46144. $this->inputBuffer = substr($this->inputBuffer, $written);
  46145. if (isset($this->inputBuffer[0])) {
  46146. return array($this->pipes[0]);
  46147. }
  46148. }
  46149. if ($input) {
  46150. for (;;) {
  46151. $data = fread($input, self::CHUNK_SIZE);
  46152. if (!isset($data[0])) {
  46153. break;
  46154. }
  46155. $written = fwrite($stdin, $data);
  46156. $data = substr($data, $written);
  46157. if (isset($data[0])) {
  46158. $this->inputBuffer = $data;
  46159. return array($this->pipes[0]);
  46160. }
  46161. }
  46162. if (feof($input)) {
  46163. $this->input = null;
  46164. }
  46165. }
  46166. }
  46167. if (null === $this->input && !isset($this->inputBuffer[0])) {
  46168. fclose($this->pipes[0]);
  46169. unset($this->pipes[0]);
  46170. } elseif (!$w) {
  46171. return array($this->pipes[0]);
  46172. }
  46173. }
  46174. public function handleError($type, $msg)
  46175. {
  46176. $this->lastError = $msg;
  46177. }
  46178. }
  46179. <?php
  46180. namespace Symfony\Component\Process\Pipes;
  46181. interface PipesInterface
  46182. {
  46183. const CHUNK_SIZE = 16384;
  46184. public function getDescriptors();
  46185. public function getFiles();
  46186. public function readAndWrite($blocking, $close = false);
  46187. public function areOpen();
  46188. public function close();
  46189. }
  46190. <?php
  46191. namespace Symfony\Component\Process\Pipes;
  46192. use Symfony\Component\Process\Process;
  46193. class UnixPipes extends AbstractPipes
  46194. {
  46195. private $ttyMode;
  46196. private $ptyMode;
  46197. private $disableOutput;
  46198. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  46199. {
  46200. $this->ttyMode = (bool) $ttyMode;
  46201. $this->ptyMode = (bool) $ptyMode;
  46202. $this->disableOutput = (bool) $disableOutput;
  46203. parent::__construct($input);
  46204. }
  46205. public function __destruct()
  46206. {
  46207. $this->close();
  46208. }
  46209. public function getDescriptors()
  46210. {
  46211. if ($this->disableOutput) {
  46212. $nullstream = fopen('/dev/null', 'c');
  46213. return array(
  46214. array('pipe', 'r'),
  46215. $nullstream,
  46216. $nullstream,
  46217. );
  46218. }
  46219. if ($this->ttyMode) {
  46220. return array(
  46221. array('file', '/dev/tty', 'r'),
  46222. array('file', '/dev/tty', 'w'),
  46223. array('file', '/dev/tty', 'w'),
  46224. );
  46225. }
  46226. if ($this->ptyMode && Process::isPtySupported()) {
  46227. return array(
  46228. array('pty'),
  46229. array('pty'),
  46230. array('pty'),
  46231. );
  46232. }
  46233. return array(
  46234. array('pipe', 'r'),
  46235. array('pipe', 'w'),
  46236. array('pipe', 'w'),
  46237. );
  46238. }
  46239. public function getFiles()
  46240. {
  46241. return array();
  46242. }
  46243. public function readAndWrite($blocking, $close = false)
  46244. {
  46245. $this->unblock();
  46246. $w = $this->write();
  46247. $read = $e = array();
  46248. $r = $this->pipes;
  46249. unset($r[0]);
  46250. set_error_handler(array($this, 'handleError'));
  46251. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  46252. restore_error_handler();
  46253. if (!$this->hasSystemCallBeenInterrupted()) {
  46254. $this->pipes = array();
  46255. }
  46256. return $read;
  46257. }
  46258. restore_error_handler();
  46259. foreach ($r as $pipe) {
  46260. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  46261. do {
  46262. $data = fread($pipe, self::CHUNK_SIZE);
  46263. $read[$type] .= $data;
  46264. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  46265. if (!isset($read[$type][0])) {
  46266. unset($read[$type]);
  46267. }
  46268. if ($close && feof($pipe)) {
  46269. fclose($pipe);
  46270. unset($this->pipes[$type]);
  46271. }
  46272. }
  46273. return $read;
  46274. }
  46275. public function areOpen()
  46276. {
  46277. return (bool) $this->pipes;
  46278. }
  46279. public static function create(Process $process, $input)
  46280. {
  46281. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  46282. }
  46283. }
  46284. <?php
  46285. namespace Symfony\Component\Process\Pipes;
  46286. use Symfony\Component\Process\Exception\RuntimeException;
  46287. use Symfony\Component\Process\Process;
  46288. class WindowsPipes extends AbstractPipes
  46289. {
  46290. private $files = array();
  46291. private $fileHandles = array();
  46292. private $lockHandles = array();
  46293. private $readBytes = array(
  46294. Process::STDOUT => 0,
  46295. Process::STDERR => 0,
  46296. );
  46297. private $disableOutput;
  46298. public function __construct($disableOutput, $input)
  46299. {
  46300. $this->disableOutput = (bool) $disableOutput;
  46301. if (!$this->disableOutput) {
  46302. $pipes = array(
  46303. Process::STDOUT => Process::OUT,
  46304. Process::STDERR => Process::ERR,
  46305. );
  46306. $tmpDir = sys_get_temp_dir();
  46307. $lastError = 'unknown reason';
  46308. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  46309. for ($i = 0;; ++$i) {
  46310. foreach ($pipes as $pipe => $name) {
  46311. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  46312. if (!$h = fopen($file.'.lock', 'w')) {
  46313. restore_error_handler();
  46314. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  46315. }
  46316. if (!flock($h, LOCK_EX | LOCK_NB)) {
  46317. continue 2;
  46318. }
  46319. if (isset($this->lockHandles[$pipe])) {
  46320. flock($this->lockHandles[$pipe], LOCK_UN);
  46321. fclose($this->lockHandles[$pipe]);
  46322. }
  46323. $this->lockHandles[$pipe] = $h;
  46324. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  46325. flock($this->lockHandles[$pipe], LOCK_UN);
  46326. fclose($this->lockHandles[$pipe]);
  46327. unset($this->lockHandles[$pipe]);
  46328. continue 2;
  46329. }
  46330. $this->fileHandles[$pipe] = $h;
  46331. $this->files[$pipe] = $file;
  46332. }
  46333. break;
  46334. }
  46335. restore_error_handler();
  46336. }
  46337. parent::__construct($input);
  46338. }
  46339. public function __destruct()
  46340. {
  46341. $this->close();
  46342. }
  46343. public function getDescriptors()
  46344. {
  46345. if ($this->disableOutput) {
  46346. $nullstream = fopen('NUL', 'c');
  46347. return array(
  46348. array('pipe', 'r'),
  46349. $nullstream,
  46350. $nullstream,
  46351. );
  46352. }
  46353. return array(
  46354. array('pipe', 'r'),
  46355. array('file', 'NUL', 'w'),
  46356. array('file', 'NUL', 'w'),
  46357. );
  46358. }
  46359. public function getFiles()
  46360. {
  46361. return $this->files;
  46362. }
  46363. public function readAndWrite($blocking, $close = false)
  46364. {
  46365. $this->unblock();
  46366. $w = $this->write();
  46367. $read = $r = $e = array();
  46368. if ($blocking) {
  46369. if ($w) {
  46370. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  46371. } elseif ($this->fileHandles) {
  46372. usleep(Process::TIMEOUT_PRECISION * 1E6);
  46373. }
  46374. }
  46375. foreach ($this->fileHandles as $type => $fileHandle) {
  46376. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  46377. if (isset($data[0])) {
  46378. $this->readBytes[$type] += \strlen($data);
  46379. $read[$type] = $data;
  46380. }
  46381. if ($close) {
  46382. ftruncate($fileHandle, 0);
  46383. fclose($fileHandle);
  46384. flock($this->lockHandles[$type], LOCK_UN);
  46385. fclose($this->lockHandles[$type]);
  46386. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  46387. }
  46388. }
  46389. return $read;
  46390. }
  46391. public function areOpen()
  46392. {
  46393. return $this->pipes && $this->fileHandles;
  46394. }
  46395. public function close()
  46396. {
  46397. parent::close();
  46398. foreach ($this->fileHandles as $type => $handle) {
  46399. ftruncate($handle, 0);
  46400. fclose($handle);
  46401. flock($this->lockHandles[$type], LOCK_UN);
  46402. fclose($this->lockHandles[$type]);
  46403. }
  46404. $this->fileHandles = $this->lockHandles = array();
  46405. }
  46406. public static function create(Process $process, $input)
  46407. {
  46408. return new static($process->isOutputDisabled(), $input);
  46409. }
  46410. }
  46411. <?php
  46412. namespace Symfony\Component\Process;
  46413. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46414. use Symfony\Component\Process\Exception\LogicException;
  46415. use Symfony\Component\Process\Exception\ProcessFailedException;
  46416. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  46417. use Symfony\Component\Process\Exception\RuntimeException;
  46418. use Symfony\Component\Process\Pipes\PipesInterface;
  46419. use Symfony\Component\Process\Pipes\UnixPipes;
  46420. use Symfony\Component\Process\Pipes\WindowsPipes;
  46421. class Process
  46422. {
  46423. const ERR = 'err';
  46424. const OUT = 'out';
  46425. const STATUS_READY = 'ready';
  46426. const STATUS_STARTED = 'started';
  46427. const STATUS_TERMINATED = 'terminated';
  46428. const STDIN = 0;
  46429. const STDOUT = 1;
  46430. const STDERR = 2;
  46431. const TIMEOUT_PRECISION = 0.2;
  46432. private $callback;
  46433. private $commandline;
  46434. private $cwd;
  46435. private $env;
  46436. private $input;
  46437. private $starttime;
  46438. private $lastOutputTime;
  46439. private $timeout;
  46440. private $idleTimeout;
  46441. private $options;
  46442. private $exitcode;
  46443. private $fallbackStatus = array();
  46444. private $processInformation;
  46445. private $outputDisabled = false;
  46446. private $stdout;
  46447. private $stderr;
  46448. private $enhanceWindowsCompatibility = true;
  46449. private $enhanceSigchildCompatibility;
  46450. private $process;
  46451. private $status = self::STATUS_READY;
  46452. private $incrementalOutputOffset = 0;
  46453. private $incrementalErrorOutputOffset = 0;
  46454. private $tty;
  46455. private $pty;
  46456. private $useFileHandles = false;
  46457. private $processPipes;
  46458. private $latestSignal;
  46459. private static $sigchild;
  46460. public static $exitCodes = array(
  46461. 0 => 'OK',
  46462. 1 => 'General error',
  46463. 2 => 'Misuse of shell builtins',
  46464. 126 => 'Invoked command cannot execute',
  46465. 127 => 'Command not found',
  46466. 128 => 'Invalid exit argument',
  46467. 129 => 'Hangup',
  46468. 130 => 'Interrupt',
  46469. 131 => 'Quit and dump core',
  46470. 132 => 'Illegal instruction',
  46471. 133 => 'Trace/breakpoint trap',
  46472. 134 => 'Process aborted',
  46473. 135 => 'Bus error: "access to undefined portion of memory object"',
  46474. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  46475. 137 => 'Kill (terminate immediately)',
  46476. 138 => 'User-defined 1',
  46477. 139 => 'Segmentation violation',
  46478. 140 => 'User-defined 2',
  46479. 141 => 'Write to pipe with no one reading',
  46480. 142 => 'Signal raised by alarm',
  46481. 143 => 'Termination (request to terminate)',
  46482. 145 => 'Child process terminated, stopped (or continued*)',
  46483. 146 => 'Continue if stopped',
  46484. 147 => 'Stop executing temporarily',
  46485. 148 => 'Terminal stop signal',
  46486. 149 => 'Background process attempting to read from tty ("in")',
  46487. 150 => 'Background process attempting to write to tty ("out")',
  46488. 151 => 'Urgent data available on socket',
  46489. 152 => 'CPU time limit exceeded',
  46490. 153 => 'File size limit exceeded',
  46491. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  46492. 155 => 'Profiling timer expired',
  46493. 157 => 'Pollable event',
  46494. 159 => 'Bad syscall',
  46495. );
  46496. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  46497. {
  46498. if (!\function_exists('proc_open')) {
  46499. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  46500. }
  46501. $this->commandline = $commandline;
  46502. $this->cwd = $cwd;
  46503. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  46504. $this->cwd = getcwd();
  46505. }
  46506. if (null !== $env) {
  46507. $this->setEnv($env);
  46508. }
  46509. $this->setInput($input);
  46510. $this->setTimeout($timeout);
  46511. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  46512. $this->pty = false;
  46513. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  46514. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  46515. }
  46516. public function __destruct()
  46517. {
  46518. $this->stop(0);
  46519. }
  46520. public function __clone()
  46521. {
  46522. $this->resetProcessData();
  46523. }
  46524. public function run($callback = null)
  46525. {
  46526. $this->start($callback);
  46527. return $this->wait();
  46528. }
  46529. public function mustRun($callback = null)
  46530. {
  46531. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46532. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46533. }
  46534. if (0 !== $this->run($callback)) {
  46535. throw new ProcessFailedException($this);
  46536. }
  46537. return $this;
  46538. }
  46539. public function start($callback = null)
  46540. {
  46541. if ($this->isRunning()) {
  46542. throw new RuntimeException('Process is already running');
  46543. }
  46544. if ($this->outputDisabled && null !== $callback) {
  46545. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  46546. }
  46547. $this->resetProcessData();
  46548. $this->starttime = $this->lastOutputTime = microtime(true);
  46549. $this->callback = $this->buildCallback($callback);
  46550. $descriptors = $this->getDescriptors();
  46551. $commandline = $this->commandline;
  46552. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  46553. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  46554. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  46555. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  46556. }
  46557. $commandline .= '"';
  46558. if (!isset($this->options['bypass_shell'])) {
  46559. $this->options['bypass_shell'] = true;
  46560. }
  46561. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46562. $descriptors[3] = array('pipe', 'w');
  46563. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  46564. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  46565. $ptsWorkaround = fopen(__FILE__, 'r');
  46566. }
  46567. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  46568. if (!\is_resource($this->process)) {
  46569. throw new RuntimeException('Unable to launch a new process.');
  46570. }
  46571. $this->status = self::STATUS_STARTED;
  46572. if (isset($descriptors[3])) {
  46573. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  46574. }
  46575. if ($this->tty) {
  46576. return;
  46577. }
  46578. $this->updateStatus(false);
  46579. $this->checkTimeout();
  46580. }
  46581. public function restart($callback = null)
  46582. {
  46583. if ($this->isRunning()) {
  46584. throw new RuntimeException('Process is already running');
  46585. }
  46586. $process = clone $this;
  46587. $process->start($callback);
  46588. return $process;
  46589. }
  46590. public function wait($callback = null)
  46591. {
  46592. $this->requireProcessIsStarted(__FUNCTION__);
  46593. $this->updateStatus(false);
  46594. if (null !== $callback) {
  46595. $this->callback = $this->buildCallback($callback);
  46596. }
  46597. do {
  46598. $this->checkTimeout();
  46599. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  46600. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46601. } while ($running);
  46602. while ($this->isRunning()) {
  46603. usleep(1000);
  46604. }
  46605. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  46606. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  46607. }
  46608. return $this->exitcode;
  46609. }
  46610. public function getPid()
  46611. {
  46612. return $this->isRunning() ? $this->processInformation['pid'] : null;
  46613. }
  46614. public function signal($signal)
  46615. {
  46616. $this->doSignal($signal, true);
  46617. return $this;
  46618. }
  46619. public function disableOutput()
  46620. {
  46621. if ($this->isRunning()) {
  46622. throw new RuntimeException('Disabling output while the process is running is not possible.');
  46623. }
  46624. if (null !== $this->idleTimeout) {
  46625. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  46626. }
  46627. $this->outputDisabled = true;
  46628. return $this;
  46629. }
  46630. public function enableOutput()
  46631. {
  46632. if ($this->isRunning()) {
  46633. throw new RuntimeException('Enabling output while the process is running is not possible.');
  46634. }
  46635. $this->outputDisabled = false;
  46636. return $this;
  46637. }
  46638. public function isOutputDisabled()
  46639. {
  46640. return $this->outputDisabled;
  46641. }
  46642. public function getOutput()
  46643. {
  46644. $this->readPipesForOutput(__FUNCTION__);
  46645. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  46646. return '';
  46647. }
  46648. return $ret;
  46649. }
  46650. public function getIncrementalOutput()
  46651. {
  46652. $this->readPipesForOutput(__FUNCTION__);
  46653. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  46654. $this->incrementalOutputOffset = ftell($this->stdout);
  46655. if (false === $latest) {
  46656. return '';
  46657. }
  46658. return $latest;
  46659. }
  46660. public function clearOutput()
  46661. {
  46662. ftruncate($this->stdout, 0);
  46663. fseek($this->stdout, 0);
  46664. $this->incrementalOutputOffset = 0;
  46665. return $this;
  46666. }
  46667. public function getErrorOutput()
  46668. {
  46669. $this->readPipesForOutput(__FUNCTION__);
  46670. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  46671. return '';
  46672. }
  46673. return $ret;
  46674. }
  46675. public function getIncrementalErrorOutput()
  46676. {
  46677. $this->readPipesForOutput(__FUNCTION__);
  46678. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  46679. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  46680. if (false === $latest) {
  46681. return '';
  46682. }
  46683. return $latest;
  46684. }
  46685. public function clearErrorOutput()
  46686. {
  46687. ftruncate($this->stderr, 0);
  46688. fseek($this->stderr, 0);
  46689. $this->incrementalErrorOutputOffset = 0;
  46690. return $this;
  46691. }
  46692. public function getExitCode()
  46693. {
  46694. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46695. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46696. }
  46697. $this->updateStatus(false);
  46698. return $this->exitcode;
  46699. }
  46700. public function getExitCodeText()
  46701. {
  46702. if (null === $exitcode = $this->getExitCode()) {
  46703. return;
  46704. }
  46705. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  46706. }
  46707. public function isSuccessful()
  46708. {
  46709. return 0 === $this->getExitCode();
  46710. }
  46711. public function hasBeenSignaled()
  46712. {
  46713. $this->requireProcessIsTerminated(__FUNCTION__);
  46714. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46715. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46716. }
  46717. return $this->processInformation['signaled'];
  46718. }
  46719. public function getTermSignal()
  46720. {
  46721. $this->requireProcessIsTerminated(__FUNCTION__);
  46722. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  46723. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46724. }
  46725. return $this->processInformation['termsig'];
  46726. }
  46727. public function hasBeenStopped()
  46728. {
  46729. $this->requireProcessIsTerminated(__FUNCTION__);
  46730. return $this->processInformation['stopped'];
  46731. }
  46732. public function getStopSignal()
  46733. {
  46734. $this->requireProcessIsTerminated(__FUNCTION__);
  46735. return $this->processInformation['stopsig'];
  46736. }
  46737. public function isRunning()
  46738. {
  46739. if (self::STATUS_STARTED !== $this->status) {
  46740. return false;
  46741. }
  46742. $this->updateStatus(false);
  46743. return $this->processInformation['running'];
  46744. }
  46745. public function isStarted()
  46746. {
  46747. return self::STATUS_READY != $this->status;
  46748. }
  46749. public function isTerminated()
  46750. {
  46751. $this->updateStatus(false);
  46752. return self::STATUS_TERMINATED == $this->status;
  46753. }
  46754. public function getStatus()
  46755. {
  46756. $this->updateStatus(false);
  46757. return $this->status;
  46758. }
  46759. public function stop($timeout = 10, $signal = null)
  46760. {
  46761. $timeoutMicro = microtime(true) + $timeout;
  46762. if ($this->isRunning()) {
  46763. $this->doSignal(15, false);
  46764. do {
  46765. usleep(1000);
  46766. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  46767. if ($this->isRunning()) {
  46768. $this->doSignal($signal ?: 9, false);
  46769. }
  46770. }
  46771. if ($this->isRunning()) {
  46772. if (isset($this->fallbackStatus['pid'])) {
  46773. unset($this->fallbackStatus['pid']);
  46774. return $this->stop(0, $signal);
  46775. }
  46776. $this->close();
  46777. }
  46778. return $this->exitcode;
  46779. }
  46780. public function addOutput($line)
  46781. {
  46782. $this->lastOutputTime = microtime(true);
  46783. fseek($this->stdout, 0, SEEK_END);
  46784. fwrite($this->stdout, $line);
  46785. fseek($this->stdout, $this->incrementalOutputOffset);
  46786. }
  46787. public function addErrorOutput($line)
  46788. {
  46789. $this->lastOutputTime = microtime(true);
  46790. fseek($this->stderr, 0, SEEK_END);
  46791. fwrite($this->stderr, $line);
  46792. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  46793. }
  46794. public function getCommandLine()
  46795. {
  46796. return $this->commandline;
  46797. }
  46798. public function setCommandLine($commandline)
  46799. {
  46800. $this->commandline = $commandline;
  46801. return $this;
  46802. }
  46803. public function getTimeout()
  46804. {
  46805. return $this->timeout;
  46806. }
  46807. public function getIdleTimeout()
  46808. {
  46809. return $this->idleTimeout;
  46810. }
  46811. public function setTimeout($timeout)
  46812. {
  46813. $this->timeout = $this->validateTimeout($timeout);
  46814. return $this;
  46815. }
  46816. public function setIdleTimeout($timeout)
  46817. {
  46818. if (null !== $timeout && $this->outputDisabled) {
  46819. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  46820. }
  46821. $this->idleTimeout = $this->validateTimeout($timeout);
  46822. return $this;
  46823. }
  46824. public function setTty($tty)
  46825. {
  46826. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  46827. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  46828. }
  46829. if ($tty) {
  46830. static $isTtySupported;
  46831. if (null === $isTtySupported) {
  46832. $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);
  46833. }
  46834. if (!$isTtySupported) {
  46835. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  46836. }
  46837. }
  46838. $this->tty = (bool) $tty;
  46839. return $this;
  46840. }
  46841. public function isTty()
  46842. {
  46843. return $this->tty;
  46844. }
  46845. public function setPty($bool)
  46846. {
  46847. $this->pty = (bool) $bool;
  46848. return $this;
  46849. }
  46850. public function isPty()
  46851. {
  46852. return $this->pty;
  46853. }
  46854. public function getWorkingDirectory()
  46855. {
  46856. if (null === $this->cwd) {
  46857. return getcwd() ?: null;
  46858. }
  46859. return $this->cwd;
  46860. }
  46861. public function setWorkingDirectory($cwd)
  46862. {
  46863. $this->cwd = $cwd;
  46864. return $this;
  46865. }
  46866. public function getEnv()
  46867. {
  46868. return $this->env;
  46869. }
  46870. public function setEnv(array $env)
  46871. {
  46872. $env = array_filter($env, function ($value) {
  46873. return !\is_array($value);
  46874. });
  46875. $this->env = array();
  46876. foreach ($env as $key => $value) {
  46877. $this->env[$key] = (string) $value;
  46878. }
  46879. return $this;
  46880. }
  46881. public function getStdin()
  46882. {
  46883. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  46884. return $this->getInput();
  46885. }
  46886. public function getInput()
  46887. {
  46888. return $this->input;
  46889. }
  46890. public function setStdin($stdin)
  46891. {
  46892. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  46893. return $this->setInput($stdin);
  46894. }
  46895. public function setInput($input)
  46896. {
  46897. if ($this->isRunning()) {
  46898. throw new LogicException('Input can not be set while the process is running.');
  46899. }
  46900. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46901. return $this;
  46902. }
  46903. public function getOptions()
  46904. {
  46905. return $this->options;
  46906. }
  46907. public function setOptions(array $options)
  46908. {
  46909. $this->options = $options;
  46910. return $this;
  46911. }
  46912. public function getEnhanceWindowsCompatibility()
  46913. {
  46914. return $this->enhanceWindowsCompatibility;
  46915. }
  46916. public function setEnhanceWindowsCompatibility($enhance)
  46917. {
  46918. $this->enhanceWindowsCompatibility = (bool) $enhance;
  46919. return $this;
  46920. }
  46921. public function getEnhanceSigchildCompatibility()
  46922. {
  46923. return $this->enhanceSigchildCompatibility;
  46924. }
  46925. public function setEnhanceSigchildCompatibility($enhance)
  46926. {
  46927. $this->enhanceSigchildCompatibility = (bool) $enhance;
  46928. return $this;
  46929. }
  46930. public function checkTimeout()
  46931. {
  46932. if (self::STATUS_STARTED !== $this->status) {
  46933. return;
  46934. }
  46935. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  46936. $this->stop(0);
  46937. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  46938. }
  46939. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  46940. $this->stop(0);
  46941. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  46942. }
  46943. }
  46944. public static function isPtySupported()
  46945. {
  46946. static $result;
  46947. if (null !== $result) {
  46948. return $result;
  46949. }
  46950. if ('\\' === \DIRECTORY_SEPARATOR) {
  46951. return $result = false;
  46952. }
  46953. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  46954. }
  46955. private function getDescriptors()
  46956. {
  46957. if ('\\' === \DIRECTORY_SEPARATOR) {
  46958. $this->processPipes = WindowsPipes::create($this, $this->input);
  46959. } else {
  46960. $this->processPipes = UnixPipes::create($this, $this->input);
  46961. }
  46962. return $this->processPipes->getDescriptors();
  46963. }
  46964. protected function buildCallback($callback)
  46965. {
  46966. $that = $this;
  46967. $out = self::OUT;
  46968. $callback = function ($type, $data) use ($that, $callback, $out) {
  46969. if ($out == $type) {
  46970. $that->addOutput($data);
  46971. } else {
  46972. $that->addErrorOutput($data);
  46973. }
  46974. if (null !== $callback) {
  46975. \call_user_func($callback, $type, $data);
  46976. }
  46977. };
  46978. return $callback;
  46979. }
  46980. protected function updateStatus($blocking)
  46981. {
  46982. if (self::STATUS_STARTED !== $this->status) {
  46983. return;
  46984. }
  46985. $this->processInformation = proc_get_status($this->process);
  46986. $running = $this->processInformation['running'];
  46987. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46988. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46989. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  46990. }
  46991. if (!$running) {
  46992. $this->close();
  46993. }
  46994. }
  46995. protected function isSigchildEnabled()
  46996. {
  46997. if (null !== self::$sigchild) {
  46998. return self::$sigchild;
  46999. }
  47000. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  47001. return self::$sigchild = false;
  47002. }
  47003. ob_start();
  47004. phpinfo(INFO_GENERAL);
  47005. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  47006. }
  47007. private function readPipesForOutput($caller)
  47008. {
  47009. if ($this->outputDisabled) {
  47010. throw new LogicException('Output has been disabled.');
  47011. }
  47012. $this->requireProcessIsStarted($caller);
  47013. $this->updateStatus(false);
  47014. }
  47015. private function validateTimeout($timeout)
  47016. {
  47017. $timeout = (float) $timeout;
  47018. if (0.0 === $timeout) {
  47019. $timeout = null;
  47020. } elseif ($timeout < 0) {
  47021. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47022. }
  47023. return $timeout;
  47024. }
  47025. private function readPipes($blocking, $close)
  47026. {
  47027. $result = $this->processPipes->readAndWrite($blocking, $close);
  47028. $callback = $this->callback;
  47029. foreach ($result as $type => $data) {
  47030. if (3 !== $type) {
  47031. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  47032. } elseif (!isset($this->fallbackStatus['signaled'])) {
  47033. $this->fallbackStatus['exitcode'] = (int) $data;
  47034. }
  47035. }
  47036. }
  47037. private function close()
  47038. {
  47039. $this->processPipes->close();
  47040. if (\is_resource($this->process)) {
  47041. proc_close($this->process);
  47042. }
  47043. $this->exitcode = $this->processInformation['exitcode'];
  47044. $this->status = self::STATUS_TERMINATED;
  47045. if (-1 === $this->exitcode) {
  47046. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  47047. $this->exitcode = 128 + $this->processInformation['termsig'];
  47048. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  47049. $this->processInformation['signaled'] = true;
  47050. $this->processInformation['termsig'] = -1;
  47051. }
  47052. }
  47053. $this->callback = null;
  47054. return $this->exitcode;
  47055. }
  47056. private function resetProcessData()
  47057. {
  47058. $this->starttime = null;
  47059. $this->callback = null;
  47060. $this->exitcode = null;
  47061. $this->fallbackStatus = array();
  47062. $this->processInformation = null;
  47063. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47064. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47065. $this->process = null;
  47066. $this->latestSignal = null;
  47067. $this->status = self::STATUS_READY;
  47068. $this->incrementalOutputOffset = 0;
  47069. $this->incrementalErrorOutputOffset = 0;
  47070. }
  47071. private function doSignal($signal, $throwException)
  47072. {
  47073. if (null === $pid = $this->getPid()) {
  47074. if ($throwException) {
  47075. throw new LogicException('Can not send signal on a non running process.');
  47076. }
  47077. return false;
  47078. }
  47079. if ('\\' === \DIRECTORY_SEPARATOR) {
  47080. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  47081. if ($exitCode && $this->isRunning()) {
  47082. if ($throwException) {
  47083. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  47084. }
  47085. return false;
  47086. }
  47087. } else {
  47088. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  47089. $ok = @proc_terminate($this->process, $signal);
  47090. } elseif (\function_exists('posix_kill')) {
  47091. $ok = @posix_kill($pid, $signal);
  47092. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  47093. $ok = false === fgets($pipes[2]);
  47094. }
  47095. if (!$ok) {
  47096. if ($throwException) {
  47097. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  47098. }
  47099. return false;
  47100. }
  47101. }
  47102. $this->latestSignal = (int) $signal;
  47103. $this->fallbackStatus['signaled'] = true;
  47104. $this->fallbackStatus['exitcode'] = -1;
  47105. $this->fallbackStatus['termsig'] = $this->latestSignal;
  47106. return true;
  47107. }
  47108. private function requireProcessIsStarted($functionName)
  47109. {
  47110. if (!$this->isStarted()) {
  47111. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  47112. }
  47113. }
  47114. private function requireProcessIsTerminated($functionName)
  47115. {
  47116. if (!$this->isTerminated()) {
  47117. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  47118. }
  47119. }
  47120. }
  47121. <?php
  47122. namespace Symfony\Component\Process;
  47123. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47124. use Symfony\Component\Process\Exception\LogicException;
  47125. class ProcessBuilder
  47126. {
  47127. private $arguments;
  47128. private $cwd;
  47129. private $env = array();
  47130. private $input;
  47131. private $timeout = 60;
  47132. private $options = array();
  47133. private $inheritEnv = true;
  47134. private $prefix = array();
  47135. private $outputDisabled = false;
  47136. public function __construct(array $arguments = array())
  47137. {
  47138. $this->arguments = $arguments;
  47139. }
  47140. public static function create(array $arguments = array())
  47141. {
  47142. return new static($arguments);
  47143. }
  47144. public function add($argument)
  47145. {
  47146. $this->arguments[] = $argument;
  47147. return $this;
  47148. }
  47149. public function setPrefix($prefix)
  47150. {
  47151. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  47152. return $this;
  47153. }
  47154. public function setArguments(array $arguments)
  47155. {
  47156. $this->arguments = $arguments;
  47157. return $this;
  47158. }
  47159. public function setWorkingDirectory($cwd)
  47160. {
  47161. $this->cwd = $cwd;
  47162. return $this;
  47163. }
  47164. public function inheritEnvironmentVariables($inheritEnv = true)
  47165. {
  47166. $this->inheritEnv = $inheritEnv;
  47167. return $this;
  47168. }
  47169. public function setEnv($name, $value)
  47170. {
  47171. $this->env[$name] = $value;
  47172. return $this;
  47173. }
  47174. public function addEnvironmentVariables(array $variables)
  47175. {
  47176. $this->env = array_replace($this->env, $variables);
  47177. return $this;
  47178. }
  47179. public function setInput($input)
  47180. {
  47181. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  47182. return $this;
  47183. }
  47184. public function setTimeout($timeout)
  47185. {
  47186. if (null === $timeout) {
  47187. $this->timeout = null;
  47188. return $this;
  47189. }
  47190. $timeout = (float) $timeout;
  47191. if ($timeout < 0) {
  47192. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47193. }
  47194. $this->timeout = $timeout;
  47195. return $this;
  47196. }
  47197. public function setOption($name, $value)
  47198. {
  47199. $this->options[$name] = $value;
  47200. return $this;
  47201. }
  47202. public function disableOutput()
  47203. {
  47204. $this->outputDisabled = true;
  47205. return $this;
  47206. }
  47207. public function enableOutput()
  47208. {
  47209. $this->outputDisabled = false;
  47210. return $this;
  47211. }
  47212. public function getProcess()
  47213. {
  47214. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  47215. throw new LogicException('You must add() command arguments before calling getProcess().');
  47216. }
  47217. $options = $this->options;
  47218. $arguments = array_merge($this->prefix, $this->arguments);
  47219. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  47220. if ($this->inheritEnv) {
  47221. $env = array_replace($_ENV, $_SERVER, $this->env);
  47222. } else {
  47223. $env = $this->env;
  47224. }
  47225. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  47226. if ($this->outputDisabled) {
  47227. $process->disableOutput();
  47228. }
  47229. return $process;
  47230. }
  47231. }
  47232. <?php
  47233. namespace Symfony\Component\Process;
  47234. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47235. class ProcessUtils
  47236. {
  47237. private function __construct()
  47238. {
  47239. }
  47240. public static function escapeArgument($argument)
  47241. {
  47242. if ('\\' === \DIRECTORY_SEPARATOR) {
  47243. if ('' === $argument) {
  47244. return escapeshellarg($argument);
  47245. }
  47246. $escapedArgument = '';
  47247. $quote = false;
  47248. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  47249. if ('"' === $part) {
  47250. $escapedArgument .= '\\"';
  47251. } elseif (self::isSurroundedBy($part, '%')) {
  47252. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  47253. } else {
  47254. if ('\\' === substr($part, -1)) {
  47255. $part .= '\\';
  47256. }
  47257. $quote = true;
  47258. $escapedArgument .= $part;
  47259. }
  47260. }
  47261. if ($quote) {
  47262. $escapedArgument = '"'.$escapedArgument.'"';
  47263. }
  47264. return $escapedArgument;
  47265. }
  47266. return "'".str_replace("'", "'\\''", $argument)."'";
  47267. }
  47268. public static function validateInput($caller, $input)
  47269. {
  47270. if (null !== $input) {
  47271. if (\is_resource($input)) {
  47272. return $input;
  47273. }
  47274. if (\is_string($input)) {
  47275. return $input;
  47276. }
  47277. if (is_scalar($input)) {
  47278. return (string) $input;
  47279. }
  47280. if (\is_object($input) && method_exists($input, '__toString')) {
  47281. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  47282. return (string) $input;
  47283. }
  47284. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  47285. }
  47286. return $input;
  47287. }
  47288. private static function isSurroundedBy($arg, $char)
  47289. {
  47290. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  47291. }
  47292. }
  47293. Copyright (c) 2011 Jordi Boggiano
  47294. Permission is hereby granted, free of charge, to any person obtaining a copy
  47295. of this software and associated documentation files (the "Software"), to deal
  47296. in the Software without restriction, including without limitation the rights
  47297. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47298. copies of the Software, and to permit persons to whom the Software is furnished
  47299. to do so, subject to the following conditions:
  47300. The above copyright notice and this permission notice shall be included in all
  47301. copies or substantial portions of the Software.
  47302. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47303. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47304. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47305. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47306. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47307. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47308. THE SOFTWARE.
  47309. <?php
  47310. namespace Seld\JsonLint;
  47311. class DuplicateKeyException extends ParsingException
  47312. {
  47313. public function __construct($message, $key, array $details = array())
  47314. {
  47315. $details['key'] = $key;
  47316. parent::__construct($message, $details);
  47317. }
  47318. public function getKey()
  47319. {
  47320. return $this->details['key'];
  47321. }
  47322. }
  47323. <?php
  47324. namespace Seld\JsonLint;
  47325. use stdClass;
  47326. class JsonParser
  47327. {
  47328. const DETECT_KEY_CONFLICTS = 1;
  47329. const ALLOW_DUPLICATE_KEYS = 2;
  47330. const PARSE_TO_ASSOC = 4;
  47331. private $lexer;
  47332. private $flags;
  47333. private $stack;
  47334. private $vstack;
  47335. private $lstack;
  47336. private $symbols = array(
  47337. 'error' => 2,
  47338. 'JSONString' => 3,
  47339. 'STRING' => 4,
  47340. 'JSONNumber' => 5,
  47341. 'NUMBER' => 6,
  47342. 'JSONNullLiteral' => 7,
  47343. 'NULL' => 8,
  47344. 'JSONBooleanLiteral' => 9,
  47345. 'TRUE' => 10,
  47346. 'FALSE' => 11,
  47347. 'JSONText' => 12,
  47348. 'JSONValue' => 13,
  47349. 'EOF' => 14,
  47350. 'JSONObject' => 15,
  47351. 'JSONArray' => 16,
  47352. '{' => 17,
  47353. '}' => 18,
  47354. 'JSONMemberList' => 19,
  47355. 'JSONMember' => 20,
  47356. ':' => 21,
  47357. ',' => 22,
  47358. '[' => 23,
  47359. ']' => 24,
  47360. 'JSONElementList' => 25,
  47361. '$accept' => 0,
  47362. '$end' => 1,
  47363. );
  47364. private $terminals_ = array(
  47365. 2 => "error",
  47366. 4 => "STRING",
  47367. 6 => "NUMBER",
  47368. 8 => "NULL",
  47369. 10 => "TRUE",
  47370. 11 => "FALSE",
  47371. 14 => "EOF",
  47372. 17 => "{",
  47373. 18 => "}",
  47374. 21 => ":",
  47375. 22 => ",",
  47376. 23 => "[",
  47377. 24 => "]",
  47378. );
  47379. private $productions_ = array(
  47380. 0,
  47381. array(3, 1),
  47382. array(5, 1),
  47383. array(7, 1),
  47384. array(9, 1),
  47385. array(9, 1),
  47386. array(12, 2),
  47387. array(13, 1),
  47388. array(13, 1),
  47389. array(13, 1),
  47390. array(13, 1),
  47391. array(13, 1),
  47392. array(13, 1),
  47393. array(15, 2),
  47394. array(15, 3),
  47395. array(20, 3),
  47396. array(19, 1),
  47397. array(19, 3),
  47398. array(16, 2),
  47399. array(16, 3),
  47400. array(25, 1),
  47401. array(25, 3)
  47402. );
  47403. 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)),
  47404. );
  47405. private $defaultActions = array(
  47406. 16 => array(2, 6)
  47407. );
  47408. public function lint($input, $flags = 0)
  47409. {
  47410. try {
  47411. $this->parse($input, $flags);
  47412. } catch (ParsingException $e) {
  47413. return $e;
  47414. }
  47415. }
  47416. public function parse($input, $flags = 0)
  47417. {
  47418. $this->failOnBOM($input);
  47419. $this->flags = $flags;
  47420. $this->stack = array(0);
  47421. $this->vstack = array(null);
  47422. $this->lstack = array();
  47423. $yytext = '';
  47424. $yylineno = 0;
  47425. $yyleng = 0;
  47426. $recovering = 0;
  47427. $TERROR = 2;
  47428. $EOF = 1;
  47429. $this->lexer = new Lexer();
  47430. $this->lexer->setInput($input);
  47431. $yyloc = $this->lexer->yylloc;
  47432. $this->lstack[] = $yyloc;
  47433. $symbol = null;
  47434. $preErrorSymbol = null;
  47435. $state = null;
  47436. $action = null;
  47437. $a = null;
  47438. $r = null;
  47439. $yyval = new stdClass;
  47440. $p = null;
  47441. $len = null;
  47442. $newState = null;
  47443. $expected = null;
  47444. $errStr = null;
  47445. while (true) {
  47446. $state = $this->stack[count($this->stack)-1];
  47447. if (isset($this->defaultActions[$state])) {
  47448. $action = $this->defaultActions[$state];
  47449. } else {
  47450. if ($symbol == null) {
  47451. $symbol = $this->lex();
  47452. }
  47453. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  47454. }
  47455. if (!$action || !$action[0]) {
  47456. if (!$recovering) {
  47457. $expected = array();
  47458. foreach ($this->table[$state] as $p => $ignore) {
  47459. if (isset($this->terminals_[$p]) && $p > 2) {
  47460. $expected[] = "'" . $this->terminals_[$p] . "'";
  47461. }
  47462. }
  47463. $message = null;
  47464. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  47465. $message = "Invalid string";
  47466. if ("'" === substr($this->lexer->match, 0, 1)) {
  47467. $message .= ", it appears you used single quotes instead of double quotes";
  47468. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  47469. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  47470. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  47471. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  47472. }
  47473. }
  47474. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47475. $errStr .= $this->lexer->showPosition() . "\n";
  47476. if ($message) {
  47477. $errStr .= $message;
  47478. } else {
  47479. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  47480. $errStr .= implode(', ', $expected);
  47481. }
  47482. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  47483. $errStr .= " - It appears you have an extra trailing comma";
  47484. }
  47485. $this->parseError($errStr, array(
  47486. 'text' => $this->lexer->match,
  47487. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  47488. 'line' => $this->lexer->yylineno,
  47489. 'loc' => $yyloc,
  47490. 'expected' => $expected,
  47491. ));
  47492. }
  47493. if ($recovering == 3) {
  47494. if ($symbol == $EOF) {
  47495. throw new ParsingException($errStr ?: 'Parsing halted.');
  47496. }
  47497. $yyleng = $this->lexer->yyleng;
  47498. $yytext = $this->lexer->yytext;
  47499. $yylineno = $this->lexer->yylineno;
  47500. $yyloc = $this->lexer->yylloc;
  47501. $symbol = $this->lex();
  47502. }
  47503. while (true) {
  47504. if (array_key_exists($TERROR, $this->table[$state])) {
  47505. break;
  47506. }
  47507. if ($state == 0) {
  47508. throw new ParsingException($errStr ?: 'Parsing halted.');
  47509. }
  47510. $this->popStack(1);
  47511. $state = $this->stack[count($this->stack)-1];
  47512. }
  47513. $preErrorSymbol = $symbol;
  47514. $symbol = $TERROR;
  47515. $state = $this->stack[count($this->stack)-1];
  47516. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  47517. $recovering = 3;
  47518. }
  47519. if (is_array($action[0]) && count($action) > 1) {
  47520. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  47521. }
  47522. switch ($action[0]) {
  47523. case 1:
  47524. $this->stack[] = $symbol;
  47525. $this->vstack[] = $this->lexer->yytext;
  47526. $this->lstack[] = $this->lexer->yylloc;
  47527. $this->stack[] = $action[1];
  47528. $symbol = null;
  47529. if (!$preErrorSymbol) {
  47530. $yyleng = $this->lexer->yyleng;
  47531. $yytext = $this->lexer->yytext;
  47532. $yylineno = $this->lexer->yylineno;
  47533. $yyloc = $this->lexer->yylloc;
  47534. if ($recovering > 0) {
  47535. $recovering--;
  47536. }
  47537. } else {
  47538. $symbol = $preErrorSymbol;
  47539. $preErrorSymbol = null;
  47540. }
  47541. break;
  47542. case 2:
  47543. $len = $this->productions_[$action[1]][1];
  47544. $yyval->token = $this->vstack[count($this->vstack) - $len];
  47545. $yyval->store = array(
  47546. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  47547. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  47548. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  47549. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  47550. );
  47551. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  47552. if (!$r instanceof Undefined) {
  47553. return $r;
  47554. }
  47555. if ($len) {
  47556. $this->popStack($len);
  47557. }
  47558. $this->stack[] = $this->productions_[$action[1]][0];
  47559. $this->vstack[] = $yyval->token;
  47560. $this->lstack[] = $yyval->store;
  47561. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  47562. $this->stack[] = $newState;
  47563. break;
  47564. case 3:
  47565. return true;
  47566. }
  47567. }
  47568. return true;
  47569. }
  47570. protected function parseError($str, $hash)
  47571. {
  47572. throw new ParsingException($str, $hash);
  47573. }
  47574. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  47575. {
  47576. $len = count($tokens) - 1;
  47577. switch ($yystate) {
  47578. case 1:
  47579. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  47580. $yyval->token = $yytext;
  47581. break;
  47582. case 2:
  47583. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  47584. $yyval->token = floatval($yytext);
  47585. } else {
  47586. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  47587. }
  47588. break;
  47589. case 3:
  47590. $yyval->token = null;
  47591. break;
  47592. case 4:
  47593. $yyval->token = true;
  47594. break;
  47595. case 5:
  47596. $yyval->token = false;
  47597. break;
  47598. case 6:
  47599. return $yyval->token = $tokens[$len-1];
  47600. case 13:
  47601. if ($this->flags & self::PARSE_TO_ASSOC) {
  47602. $yyval->token = array();
  47603. } else {
  47604. $yyval->token = new stdClass;
  47605. }
  47606. break;
  47607. case 14:
  47608. $yyval->token = $tokens[$len-1];
  47609. break;
  47610. case 15:
  47611. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  47612. break;
  47613. case 16:
  47614. if (PHP_VERSION_ID < 70100) {
  47615. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47616. } else {
  47617. $property = $tokens[$len][0];
  47618. }
  47619. if ($this->flags & self::PARSE_TO_ASSOC) {
  47620. $yyval->token = array();
  47621. $yyval->token[$property] = $tokens[$len][1];
  47622. } else {
  47623. $yyval->token = new stdClass;
  47624. $yyval->token->$property = $tokens[$len][1];
  47625. }
  47626. break;
  47627. case 17:
  47628. if ($this->flags & self::PARSE_TO_ASSOC) {
  47629. $yyval->token =& $tokens[$len-2];
  47630. $key = $tokens[$len][0];
  47631. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  47632. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47633. $errStr .= $this->lexer->showPosition() . "\n";
  47634. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47635. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47636. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  47637. $duplicateCount = 1;
  47638. do {
  47639. $duplicateKey = $key . '.' . $duplicateCount++;
  47640. } while (isset($tokens[$len-2][$duplicateKey]));
  47641. $key = $duplicateKey;
  47642. }
  47643. $tokens[$len-2][$key] = $tokens[$len][1];
  47644. } else {
  47645. $yyval->token = $tokens[$len-2];
  47646. if (PHP_VERSION_ID < 70100) {
  47647. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47648. } else {
  47649. $key = $tokens[$len][0];
  47650. }
  47651. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  47652. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47653. $errStr .= $this->lexer->showPosition() . "\n";
  47654. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47655. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47656. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  47657. $duplicateCount = 1;
  47658. do {
  47659. $duplicateKey = $key . '.' . $duplicateCount++;
  47660. } while (isset($tokens[$len-2]->$duplicateKey));
  47661. $key = $duplicateKey;
  47662. }
  47663. $tokens[$len-2]->$key = $tokens[$len][1];
  47664. }
  47665. break;
  47666. case 18:
  47667. $yyval->token = array();
  47668. break;
  47669. case 19:
  47670. $yyval->token = $tokens[$len-1];
  47671. break;
  47672. case 20:
  47673. $yyval->token = array($tokens[$len]);
  47674. break;
  47675. case 21:
  47676. $tokens[$len-2][] = $tokens[$len];
  47677. $yyval->token = $tokens[$len-2];
  47678. break;
  47679. }
  47680. return new Undefined();
  47681. }
  47682. private function stringInterpolation($match)
  47683. {
  47684. switch ($match[0]) {
  47685. case '\\\\':
  47686. return '\\';
  47687. case '\"':
  47688. return '"';
  47689. case '\b':
  47690. return chr(8);
  47691. case '\f':
  47692. return chr(12);
  47693. case '\n':
  47694. return "\n";
  47695. case '\r':
  47696. return "\r";
  47697. case '\t':
  47698. return "\t";
  47699. case '\/':
  47700. return "/";
  47701. default:
  47702. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  47703. }
  47704. }
  47705. private function popStack($n)
  47706. {
  47707. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  47708. $this->vstack = array_slice($this->vstack, 0, - $n);
  47709. $this->lstack = array_slice($this->lstack, 0, - $n);
  47710. }
  47711. private function lex()
  47712. {
  47713. $token = $this->lexer->lex() ?: 1;
  47714. if (!is_numeric($token)) {
  47715. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  47716. }
  47717. return $token;
  47718. }
  47719. private function failOnBOM($input)
  47720. {
  47721. $bom = "\xEF\xBB\xBF";
  47722. if (substr($input, 0, 3) === $bom) {
  47723. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  47724. }
  47725. }
  47726. }
  47727. <?php
  47728. namespace Seld\JsonLint;
  47729. class Lexer
  47730. {
  47731. private $EOF = 1;
  47732. private $rules = array(
  47733. 0 => '/^\s+/',
  47734. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  47735. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  47736. 3 => '/^\{/',
  47737. 4 => '/^\}/',
  47738. 5 => '/^\[/',
  47739. 6 => '/^\]/',
  47740. 7 => '/^,/',
  47741. 8 => '/^:/',
  47742. 9 => '/^true\b/',
  47743. 10 => '/^false\b/',
  47744. 11 => '/^null\b/',
  47745. 12 => '/^$/',
  47746. 13 => '/^./',
  47747. );
  47748. private $conditions = array(
  47749. "INITIAL" => array(
  47750. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  47751. "inclusive" => true,
  47752. ),
  47753. );
  47754. private $conditionStack;
  47755. private $input;
  47756. private $more;
  47757. private $done;
  47758. private $matched;
  47759. public $match;
  47760. public $yylineno;
  47761. public $yyleng;
  47762. public $yytext;
  47763. public $yylloc;
  47764. public function lex()
  47765. {
  47766. $r = $this->next();
  47767. if (!$r instanceof Undefined) {
  47768. return $r;
  47769. }
  47770. return $this->lex();
  47771. }
  47772. public function setInput($input)
  47773. {
  47774. $this->input = $input;
  47775. $this->more = false;
  47776. $this->done = false;
  47777. $this->yylineno = $this->yyleng = 0;
  47778. $this->yytext = $this->matched = $this->match = '';
  47779. $this->conditionStack = array('INITIAL');
  47780. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  47781. return $this;
  47782. }
  47783. public function showPosition()
  47784. {
  47785. $pre = str_replace("\n", '', $this->getPastInput());
  47786. $c = str_repeat('-', max(0, strlen($pre) - 1));
  47787. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  47788. }
  47789. public function getPastInput()
  47790. {
  47791. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  47792. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  47793. }
  47794. public function getUpcomingInput()
  47795. {
  47796. $next = $this->match;
  47797. if (strlen($next) < 20) {
  47798. $next .= substr($this->input, 0, 20 - strlen($next));
  47799. }
  47800. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  47801. }
  47802. protected function parseError($str, $hash)
  47803. {
  47804. throw new \Exception($str);
  47805. }
  47806. private function next()
  47807. {
  47808. if ($this->done) {
  47809. return $this->EOF;
  47810. }
  47811. if ($this->input === '') {
  47812. $this->done = true;
  47813. }
  47814. $token = null;
  47815. $match = null;
  47816. $col = null;
  47817. $lines = null;
  47818. if (!$this->more) {
  47819. $this->yytext = '';
  47820. $this->match = '';
  47821. }
  47822. $rules = $this->getCurrentRules();
  47823. $rulesLen = count($rules);
  47824. for ($i=0; $i < $rulesLen; $i++) {
  47825. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  47826. preg_match_all('/\n.*/', $match[0], $lines);
  47827. $lines = $lines[0];
  47828. if ($lines) {
  47829. $this->yylineno += count($lines);
  47830. }
  47831. $this->yylloc = array(
  47832. 'first_line' => $this->yylloc['last_line'],
  47833. 'last_line' => $this->yylineno+1,
  47834. 'first_column' => $this->yylloc['last_column'],
  47835. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  47836. );
  47837. $this->yytext .= $match[0];
  47838. $this->match .= $match[0];
  47839. $this->yyleng = strlen($this->yytext);
  47840. $this->more = false;
  47841. $this->input = substr($this->input, strlen($match[0]));
  47842. $this->matched .= $match[0];
  47843. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  47844. if ($token) {
  47845. return $token;
  47846. }
  47847. return new Undefined();
  47848. }
  47849. }
  47850. if ($this->input === "") {
  47851. return $this->EOF;
  47852. }
  47853. $this->parseError(
  47854. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  47855. array(
  47856. 'text' => "",
  47857. 'token' => null,
  47858. 'line' => $this->yylineno,
  47859. )
  47860. );
  47861. }
  47862. private function getCurrentRules()
  47863. {
  47864. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  47865. }
  47866. private function performAction($avoiding_name_collisions, $YY_START)
  47867. {
  47868. switch ($avoiding_name_collisions) {
  47869. case 0:
  47870. break;
  47871. case 1:
  47872. return 6;
  47873. break;
  47874. case 2:
  47875. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  47876. return 4;
  47877. case 3:
  47878. return 17;
  47879. case 4:
  47880. return 18;
  47881. case 5:
  47882. return 23;
  47883. case 6:
  47884. return 24;
  47885. case 7:
  47886. return 22;
  47887. case 8:
  47888. return 21;
  47889. case 9:
  47890. return 10;
  47891. case 10:
  47892. return 11;
  47893. case 11:
  47894. return 8;
  47895. case 12:
  47896. return 14;
  47897. case 13:
  47898. return 'INVALID';
  47899. }
  47900. }
  47901. }
  47902. <?php
  47903. namespace Seld\JsonLint;
  47904. class ParsingException extends \Exception
  47905. {
  47906. protected $details;
  47907. public function __construct($message, $details = array())
  47908. {
  47909. $this->details = $details;
  47910. parent::__construct($message);
  47911. }
  47912. public function getDetails()
  47913. {
  47914. return $this->details;
  47915. }
  47916. }
  47917. <?php
  47918. namespace Seld\JsonLint;
  47919. class Undefined
  47920. {
  47921. }
  47922. MIT License
  47923. Copyright (c) 2016
  47924. Permission is hereby granted, free of charge, to any person obtaining a copy
  47925. of this software and associated documentation files (the "Software"), to deal
  47926. in the Software without restriction, including without limitation the rights
  47927. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47928. copies of the Software, and to permit persons to whom the Software is
  47929. furnished to do so, subject to the following conditions:
  47930. The above copyright notice and this permission notice shall be included in all
  47931. copies or substantial portions of the Software.
  47932. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47933. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47934. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47935. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47936. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47937. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47938. SOFTWARE.
  47939. <?php
  47940. require __DIR__ . '/../vendor/autoload.php';
  47941. $data = json_decode(file_get_contents('data.json'));
  47942. $validator = new JsonSchema\Validator();
  47943. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  47944. if ($validator->isValid()) {
  47945. echo "The supplied JSON validates against the schema.\n";
  47946. } else {
  47947. echo "JSON does not validate. Violations:\n";
  47948. foreach ($validator->getErrors() as $error) {
  47949. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  47950. }
  47951. }
  47952. <?php
  47953. namespace JsonSchema\Constraints;
  47954. use JsonSchema\Entity\JsonPointer;
  47955. use JsonSchema\Exception\InvalidArgumentException;
  47956. use JsonSchema\Exception\ValidationException;
  47957. use JsonSchema\Validator;
  47958. class BaseConstraint
  47959. {
  47960. protected $errors = array();
  47961. protected $errorMask = Validator::ERROR_NONE;
  47962. protected $factory;
  47963. public function __construct(Factory $factory = null)
  47964. {
  47965. $this->factory = $factory ?: new Factory();
  47966. }
  47967. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47968. {
  47969. $error = array(
  47970. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  47971. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  47972. 'message' => $message,
  47973. 'constraint' => $constraint,
  47974. 'context' => $this->factory->getErrorContext(),
  47975. );
  47976. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  47977. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  47978. }
  47979. if (is_array($more) && count($more) > 0) {
  47980. $error += $more;
  47981. }
  47982. $this->errors[] = $error;
  47983. $this->errorMask |= $error['context'];
  47984. }
  47985. public function addErrors(array $errors)
  47986. {
  47987. if ($errors) {
  47988. $this->errors = array_merge($this->errors, $errors);
  47989. $errorMask = &$this->errorMask;
  47990. array_walk($errors, function ($error) use (&$errorMask) {
  47991. if (isset($error['context'])) {
  47992. $errorMask |= $error['context'];
  47993. }
  47994. });
  47995. }
  47996. }
  47997. public function getErrors($errorContext = Validator::ERROR_ALL)
  47998. {
  47999. if ($errorContext === Validator::ERROR_ALL) {
  48000. return $this->errors;
  48001. }
  48002. return array_filter($this->errors, function ($error) use ($errorContext) {
  48003. if ($errorContext & $error['context']) {
  48004. return true;
  48005. }
  48006. });
  48007. }
  48008. public function numErrors($errorContext = Validator::ERROR_ALL)
  48009. {
  48010. if ($errorContext === Validator::ERROR_ALL) {
  48011. return count($this->errors);
  48012. }
  48013. return count($this->getErrors($errorContext));
  48014. }
  48015. public function isValid()
  48016. {
  48017. return !$this->getErrors();
  48018. }
  48019. public function reset()
  48020. {
  48021. $this->errors = array();
  48022. $this->errorMask = Validator::ERROR_NONE;
  48023. }
  48024. public function getErrorMask()
  48025. {
  48026. return $this->errorMask;
  48027. }
  48028. public static function arrayToObjectRecursive($array)
  48029. {
  48030. $json = json_encode($array);
  48031. if (json_last_error() !== \JSON_ERROR_NONE) {
  48032. $message = 'Unable to encode schema array as JSON';
  48033. if (function_exists('json_last_error_msg')) {
  48034. $message .= ': ' . json_last_error_msg();
  48035. }
  48036. throw new InvalidArgumentException($message);
  48037. }
  48038. return (object) json_decode($json);
  48039. }
  48040. }
  48041. <?php
  48042. namespace JsonSchema\Constraints;
  48043. use JsonSchema\Entity\JsonPointer;
  48044. class CollectionConstraint extends Constraint
  48045. {
  48046. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48047. {
  48048. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  48049. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  48050. }
  48051. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  48052. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  48053. }
  48054. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  48055. $unique = $value;
  48056. if (is_array($value) && count($value)) {
  48057. $unique = array_map(function ($e) {
  48058. return var_export($e, true);
  48059. }, $value);
  48060. }
  48061. if (count(array_unique($unique)) != count($value)) {
  48062. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  48063. }
  48064. }
  48065. if (isset($schema->items)) {
  48066. $this->validateItems($value, $schema, $path, $i);
  48067. }
  48068. }
  48069. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48070. {
  48071. if (is_object($schema->items)) {
  48072. foreach ($value as $k => &$v) {
  48073. $initErrors = $this->getErrors();
  48074. $this->checkUndefined($v, $schema->items, $path, $k);
  48075. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  48076. $secondErrors = $this->getErrors();
  48077. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48078. }
  48079. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  48080. $this->errors = $secondErrors;
  48081. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  48082. $this->errors = $initErrors;
  48083. }
  48084. }
  48085. unset($v);
  48086. } else {
  48087. foreach ($value as $k => &$v) {
  48088. if (array_key_exists($k, $schema->items)) {
  48089. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  48090. } else {
  48091. if (property_exists($schema, 'additionalItems')) {
  48092. if ($schema->additionalItems !== false) {
  48093. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48094. } else {
  48095. $this->addError(
  48096. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  48097. }
  48098. } else {
  48099. $this->checkUndefined($v, new \stdClass(), $path, $k);
  48100. }
  48101. }
  48102. }
  48103. unset($v);
  48104. if (count($value) > 0) {
  48105. for ($k = count($value); $k < count($schema->items); $k++) {
  48106. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  48107. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  48108. }
  48109. }
  48110. }
  48111. }
  48112. }
  48113. <?php
  48114. namespace JsonSchema\Constraints;
  48115. use JsonSchema\Entity\JsonPointer;
  48116. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  48117. {
  48118. protected $inlineSchemaProperty = '$schema';
  48119. const CHECK_MODE_NONE = 0x00000000;
  48120. const CHECK_MODE_NORMAL = 0x00000001;
  48121. const CHECK_MODE_TYPE_CAST = 0x00000002;
  48122. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  48123. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  48124. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  48125. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  48126. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  48127. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  48128. protected function incrementPath(JsonPointer $path = null, $i)
  48129. {
  48130. $path = $path ?: new JsonPointer('');
  48131. $path = $path->withPropertyPaths(
  48132. array_merge(
  48133. $path->getPropertyPaths(),
  48134. array_filter(array($i), 'strlen')
  48135. )
  48136. );
  48137. return $path;
  48138. }
  48139. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48140. {
  48141. $validator = $this->factory->createInstanceFor('collection');
  48142. $validator->check($value, $schema, $path, $i);
  48143. $this->addErrors($validator->getErrors());
  48144. }
  48145. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  48146. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  48147. {
  48148. $validator = $this->factory->createInstanceFor('object');
  48149. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  48150. $this->addErrors($validator->getErrors());
  48151. }
  48152. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48153. {
  48154. $validator = $this->factory->createInstanceFor('type');
  48155. $validator->check($value, $schema, $path, $i);
  48156. $this->addErrors($validator->getErrors());
  48157. }
  48158. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48159. {
  48160. $validator = $this->factory->createInstanceFor('undefined');
  48161. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  48162. $this->addErrors($validator->getErrors());
  48163. }
  48164. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  48165. {
  48166. $validator = $this->factory->createInstanceFor('string');
  48167. $validator->check($value, $schema, $path, $i);
  48168. $this->addErrors($validator->getErrors());
  48169. }
  48170. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  48171. {
  48172. $validator = $this->factory->createInstanceFor('number');
  48173. $validator->check($value, $schema, $path, $i);
  48174. $this->addErrors($validator->getErrors());
  48175. }
  48176. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  48177. {
  48178. $validator = $this->factory->createInstanceFor('enum');
  48179. $validator->check($value, $schema, $path, $i);
  48180. $this->addErrors($validator->getErrors());
  48181. }
  48182. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  48183. {
  48184. $validator = $this->factory->createInstanceFor('format');
  48185. $validator->check($value, $schema, $path, $i);
  48186. $this->addErrors($validator->getErrors());
  48187. }
  48188. protected function getTypeCheck()
  48189. {
  48190. return $this->factory->getTypeCheck();
  48191. }
  48192. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  48193. {
  48194. $result = array_map(
  48195. function ($path) {
  48196. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  48197. },
  48198. $pointer->getPropertyPaths()
  48199. );
  48200. return trim(implode('', $result), '.');
  48201. }
  48202. }
  48203. <?php
  48204. namespace JsonSchema\Constraints;
  48205. use JsonSchema\Entity\JsonPointer;
  48206. interface ConstraintInterface
  48207. {
  48208. public function getErrors();
  48209. public function addErrors(array $errors);
  48210. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  48211. public function isValid();
  48212. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  48213. }
  48214. <?php
  48215. namespace JsonSchema\Constraints;
  48216. use JsonSchema\Entity\JsonPointer;
  48217. class EnumConstraint extends Constraint
  48218. {
  48219. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48220. {
  48221. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  48222. return;
  48223. }
  48224. $type = gettype($element);
  48225. foreach ($schema->enum as $enum) {
  48226. $enumType = gettype($enum);
  48227. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  48228. if ((object) $element == $enum) {
  48229. return;
  48230. }
  48231. }
  48232. if ($type === gettype($enum)) {
  48233. if ($type == 'object') {
  48234. if ($element == $enum) {
  48235. return;
  48236. }
  48237. } elseif ($element === $enum) {
  48238. return;
  48239. }
  48240. }
  48241. }
  48242. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  48243. }
  48244. }
  48245. <?php
  48246. namespace JsonSchema\Constraints;
  48247. use JsonSchema\Exception\InvalidArgumentException;
  48248. use JsonSchema\SchemaStorage;
  48249. use JsonSchema\SchemaStorageInterface;
  48250. use JsonSchema\Uri\UriRetriever;
  48251. use JsonSchema\UriRetrieverInterface;
  48252. use JsonSchema\Validator;
  48253. class Factory
  48254. {
  48255. protected $schemaStorage;
  48256. protected $uriRetriever;
  48257. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  48258. private $typeCheck = array();
  48259. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  48260. protected $constraintMap = array(
  48261. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  48262. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  48263. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  48264. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  48265. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  48266. 'string' => 'JsonSchema\Constraints\StringConstraint',
  48267. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  48268. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  48269. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  48270. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  48271. 'validator' => 'JsonSchema\Validator'
  48272. );
  48273. private $instanceCache = array();
  48274. public function __construct(
  48275. SchemaStorageInterface $schemaStorage = null,
  48276. UriRetrieverInterface $uriRetriever = null,
  48277. $checkMode = Constraint::CHECK_MODE_NORMAL
  48278. ) {
  48279. $this->setConfig($checkMode);
  48280. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48281. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  48282. }
  48283. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  48284. {
  48285. $this->checkMode = $checkMode;
  48286. }
  48287. public function addConfig($options)
  48288. {
  48289. $this->checkMode |= $options;
  48290. }
  48291. public function removeConfig($options)
  48292. {
  48293. $this->checkMode &= ~$options;
  48294. }
  48295. public function getConfig($options = null)
  48296. {
  48297. if ($options === null) {
  48298. return $this->checkMode;
  48299. }
  48300. return $this->checkMode & $options;
  48301. }
  48302. public function getUriRetriever()
  48303. {
  48304. return $this->uriRetriever;
  48305. }
  48306. public function getSchemaStorage()
  48307. {
  48308. return $this->schemaStorage;
  48309. }
  48310. public function getTypeCheck()
  48311. {
  48312. if (!isset($this->typeCheck[$this->checkMode])) {
  48313. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  48314. ? new TypeCheck\LooseTypeCheck()
  48315. : new TypeCheck\StrictTypeCheck();
  48316. }
  48317. return $this->typeCheck[$this->checkMode];
  48318. }
  48319. public function setConstraintClass($name, $class)
  48320. {
  48321. if (!class_exists($class)) {
  48322. throw new InvalidArgumentException('Unknown constraint ' . $name);
  48323. }
  48324. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  48325. throw new InvalidArgumentException('Invalid class ' . $name);
  48326. }
  48327. $this->constraintMap[$name] = $class;
  48328. return $this;
  48329. }
  48330. public function createInstanceFor($constraintName)
  48331. {
  48332. if (!isset($this->constraintMap[$constraintName])) {
  48333. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  48334. }
  48335. if (!isset($this->instanceCache[$constraintName])) {
  48336. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  48337. }
  48338. return clone $this->instanceCache[$constraintName];
  48339. }
  48340. public function getErrorContext()
  48341. {
  48342. return $this->errorContext;
  48343. }
  48344. public function setErrorContext($errorContext)
  48345. {
  48346. $this->errorContext = $errorContext;
  48347. }
  48348. }
  48349. <?php
  48350. namespace JsonSchema\Constraints;
  48351. use JsonSchema\Entity\JsonPointer;
  48352. use JsonSchema\Rfc3339;
  48353. class FormatConstraint extends Constraint
  48354. {
  48355. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48356. {
  48357. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  48358. return;
  48359. }
  48360. switch ($schema->format) {
  48361. case 'date':
  48362. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  48363. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  48364. }
  48365. break;
  48366. case 'time':
  48367. if (!$this->validateDateTime($element, 'H:i:s')) {
  48368. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  48369. }
  48370. break;
  48371. case 'date-time':
  48372. if (null === Rfc3339::createFromString($element)) {
  48373. $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));
  48374. }
  48375. break;
  48376. case 'utc-millisec':
  48377. if (!$this->validateDateTime($element, 'U')) {
  48378. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  48379. }
  48380. break;
  48381. case 'regex':
  48382. if (!$this->validateRegex($element)) {
  48383. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  48384. }
  48385. break;
  48386. case 'color':
  48387. if (!$this->validateColor($element)) {
  48388. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  48389. }
  48390. break;
  48391. case 'style':
  48392. if (!$this->validateStyle($element)) {
  48393. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  48394. }
  48395. break;
  48396. case 'phone':
  48397. if (!$this->validatePhone($element)) {
  48398. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  48399. }
  48400. break;
  48401. case 'uri':
  48402. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48403. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48404. }
  48405. break;
  48406. case 'uriref':
  48407. case 'uri-reference':
  48408. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48409. if (substr($element, 0, 2) === '//') {
  48410. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48411. } elseif (substr($element, 0, 1) === '/') {
  48412. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48413. } elseif (strlen($element)) {
  48414. $pathParts = explode('/', $element, 2);
  48415. if (strpos($pathParts[0], ':') !== false) {
  48416. $validURL = null;
  48417. } else {
  48418. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48419. }
  48420. } else {
  48421. $validURL = null;
  48422. }
  48423. if ($validURL === null) {
  48424. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48425. }
  48426. }
  48427. break;
  48428. case 'email':
  48429. $filterFlags = FILTER_NULL_ON_FAILURE;
  48430. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  48431. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  48432. }
  48433. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  48434. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  48435. }
  48436. break;
  48437. case 'ip-address':
  48438. case 'ipv4':
  48439. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  48440. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48441. }
  48442. break;
  48443. case 'ipv6':
  48444. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  48445. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48446. }
  48447. break;
  48448. case 'host-name':
  48449. case 'hostname':
  48450. if (!$this->validateHostname($element)) {
  48451. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48452. }
  48453. break;
  48454. default:
  48455. break;
  48456. }
  48457. }
  48458. protected function validateDateTime($datetime, $format)
  48459. {
  48460. $dt = \DateTime::createFromFormat($format, $datetime);
  48461. if (!$dt) {
  48462. return false;
  48463. }
  48464. if ($datetime === $dt->format($format)) {
  48465. return true;
  48466. }
  48467. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48468. return true;
  48469. }
  48470. return false;
  48471. }
  48472. protected function validateRegex($regex)
  48473. {
  48474. return false !== @preg_match('/' . $regex . '/u', '');
  48475. }
  48476. protected function validateColor($color)
  48477. {
  48478. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48479. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48480. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48481. return true;
  48482. }
  48483. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48484. }
  48485. protected function validateStyle($style)
  48486. {
  48487. $properties = explode(';', rtrim($style, ';'));
  48488. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48489. return empty($invalidEntries);
  48490. }
  48491. protected function validatePhone($phone)
  48492. {
  48493. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48494. }
  48495. protected function validateHostname($host)
  48496. {
  48497. $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';
  48498. return preg_match($hostnameRegex, $host);
  48499. }
  48500. }
  48501. <?php
  48502. namespace JsonSchema\Constraints;
  48503. use JsonSchema\Entity\JsonPointer;
  48504. class NumberConstraint extends Constraint
  48505. {
  48506. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48507. {
  48508. if (isset($schema->exclusiveMinimum)) {
  48509. if (isset($schema->minimum)) {
  48510. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48511. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48512. } elseif ($element < $schema->minimum) {
  48513. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48514. }
  48515. } else {
  48516. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48517. }
  48518. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48519. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48520. }
  48521. if (isset($schema->exclusiveMaximum)) {
  48522. if (isset($schema->maximum)) {
  48523. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48524. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48525. } elseif ($element > $schema->maximum) {
  48526. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48527. }
  48528. } else {
  48529. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48530. }
  48531. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48532. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48533. }
  48534. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48535. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48536. }
  48537. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48538. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48539. }
  48540. $this->checkFormat($element, $schema, $path, $i);
  48541. }
  48542. private function fmod($number1, $number2)
  48543. {
  48544. $modulus = ($number1 - round($number1 / $number2) * $number2);
  48545. $precision = 0.0000000001;
  48546. if (-$precision < $modulus && $modulus < $precision) {
  48547. return 0.0;
  48548. }
  48549. return $modulus;
  48550. }
  48551. }
  48552. <?php
  48553. namespace JsonSchema\Constraints;
  48554. use JsonSchema\Entity\JsonPointer;
  48555. class ObjectConstraint extends Constraint
  48556. {
  48557. protected $appliedDefaults = array();
  48558. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48559. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48560. {
  48561. if ($element instanceof UndefinedConstraint) {
  48562. return;
  48563. }
  48564. $this->appliedDefaults = $appliedDefaults;
  48565. $matches = array();
  48566. if ($patternProperties) {
  48567. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48568. }
  48569. if ($properties) {
  48570. $this->validateProperties($element, $properties, $path);
  48571. }
  48572. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48573. }
  48574. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48575. {
  48576. $try = array('/', '#', '+', '~', '%');
  48577. $matches = array();
  48578. foreach ($patternProperties as $pregex => $schema) {
  48579. $delimiter = '/';
  48580. foreach ($try as $delimiter) {
  48581. if (strpos($pregex, $delimiter) === false) {
  48582. break;
  48583. }
  48584. }
  48585. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48586. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48587. continue;
  48588. }
  48589. foreach ($element as $i => $value) {
  48590. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48591. $matches[] = $i;
  48592. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48593. }
  48594. }
  48595. }
  48596. return $matches;
  48597. }
  48598. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48599. $properties = null, $additionalProp = null)
  48600. {
  48601. $this->validateMinMaxConstraint($element, $schema, $path);
  48602. foreach ($element as $i => $value) {
  48603. $definition = $this->getProperty($properties, $i);
  48604. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48605. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48606. }
  48607. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48608. if ($additionalProp === true) {
  48609. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48610. } else {
  48611. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48612. }
  48613. }
  48614. $require = $this->getProperty($definition, 'requires');
  48615. if ($require && !$this->getProperty($element, $require)) {
  48616. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48617. }
  48618. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48619. if (is_object($property)) {
  48620. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48621. }
  48622. }
  48623. }
  48624. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48625. {
  48626. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48627. foreach ($properties as $i => $value) {
  48628. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48629. $definition = $this->getProperty($properties, $i);
  48630. if (is_object($definition)) {
  48631. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48632. }
  48633. }
  48634. }
  48635. protected function &getProperty(&$element, $property, $fallback = null)
  48636. {
  48637. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48638. return $element[$property];
  48639. } elseif (is_object($element) && property_exists($element, $property)) {
  48640. return $element->$property;
  48641. }
  48642. return $fallback;
  48643. }
  48644. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48645. {
  48646. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48647. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48648. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48649. }
  48650. }
  48651. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48652. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48653. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48654. }
  48655. }
  48656. }
  48657. }
  48658. <?php
  48659. namespace JsonSchema\Constraints;
  48660. use JsonSchema\Entity\JsonPointer;
  48661. use JsonSchema\Exception\InvalidArgumentException;
  48662. use JsonSchema\Exception\InvalidSchemaException;
  48663. use JsonSchema\Exception\RuntimeException;
  48664. use JsonSchema\Validator;
  48665. class SchemaConstraint extends Constraint
  48666. {
  48667. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48668. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48669. {
  48670. if ($schema !== null) {
  48671. $validationSchema = $schema;
  48672. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48673. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48674. } else {
  48675. throw new InvalidArgumentException('no schema found to verify against');
  48676. }
  48677. if (is_array($validationSchema)) {
  48678. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48679. }
  48680. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48681. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48682. throw new RuntimeException('Cannot validate the schema of a non-object');
  48683. }
  48684. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48685. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48686. } else {
  48687. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48688. }
  48689. $schemaStorage = $this->factory->getSchemaStorage();
  48690. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48691. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48692. }
  48693. $initialErrorCount = $this->numErrors();
  48694. $initialConfig = $this->factory->getConfig();
  48695. $initialContext = $this->factory->getErrorContext();
  48696. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48697. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48698. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48699. try {
  48700. $this->check($validationSchema, $schemaSpec);
  48701. } catch (\Exception $e) {
  48702. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48703. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48704. }
  48705. }
  48706. if ($this->numErrors() > $initialErrorCount) {
  48707. $this->addError($path, 'Schema is not valid', 'schema');
  48708. }
  48709. $this->factory->setConfig($initialConfig);
  48710. $this->factory->setErrorContext($initialContext);
  48711. }
  48712. $this->checkUndefined($element, $validationSchema, $path, $i);
  48713. }
  48714. }
  48715. <?php
  48716. namespace JsonSchema\Constraints;
  48717. use JsonSchema\Entity\JsonPointer;
  48718. class StringConstraint extends Constraint
  48719. {
  48720. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48721. {
  48722. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48723. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48724. 'maxLength' => $schema->maxLength,
  48725. ));
  48726. }
  48727. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48728. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48729. 'minLength' => $schema->minLength,
  48730. ));
  48731. }
  48732. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48733. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48734. 'pattern' => $schema->pattern,
  48735. ));
  48736. }
  48737. $this->checkFormat($element, $schema, $path, $i);
  48738. }
  48739. private function strlen($string)
  48740. {
  48741. if (extension_loaded('mbstring')) {
  48742. return mb_strlen($string, mb_detect_encoding($string));
  48743. }
  48744. return strlen($string);
  48745. }
  48746. }
  48747. <?php
  48748. namespace JsonSchema\Constraints\TypeCheck;
  48749. class LooseTypeCheck implements TypeCheckInterface
  48750. {
  48751. public static function isObject($value)
  48752. {
  48753. return
  48754. is_object($value) ||
  48755. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48756. }
  48757. public static function isArray($value)
  48758. {
  48759. return
  48760. is_array($value) &&
  48761. (count($value) == 0 || !self::isAssociativeArray($value));
  48762. }
  48763. public static function propertyGet($value, $property)
  48764. {
  48765. if (is_object($value)) {
  48766. return $value->{$property};
  48767. }
  48768. return $value[$property];
  48769. }
  48770. public static function propertySet(&$value, $property, $data)
  48771. {
  48772. if (is_object($value)) {
  48773. $value->{$property} = $data;
  48774. } else {
  48775. $value[$property] = $data;
  48776. }
  48777. }
  48778. public static function propertyExists($value, $property)
  48779. {
  48780. if (is_object($value)) {
  48781. return property_exists($value, $property);
  48782. }
  48783. return array_key_exists($property, $value);
  48784. }
  48785. public static function propertyCount($value)
  48786. {
  48787. if (is_object($value)) {
  48788. return count(get_object_vars($value));
  48789. }
  48790. return count($value);
  48791. }
  48792. private static function isAssociativeArray($arr)
  48793. {
  48794. return array_keys($arr) !== range(0, count($arr) - 1);
  48795. }
  48796. }
  48797. <?php
  48798. namespace JsonSchema\Constraints\TypeCheck;
  48799. class StrictTypeCheck implements TypeCheckInterface
  48800. {
  48801. public static function isObject($value)
  48802. {
  48803. return is_object($value);
  48804. }
  48805. public static function isArray($value)
  48806. {
  48807. return is_array($value);
  48808. }
  48809. public static function propertyGet($value, $property)
  48810. {
  48811. return $value->{$property};
  48812. }
  48813. public static function propertySet(&$value, $property, $data)
  48814. {
  48815. $value->{$property} = $data;
  48816. }
  48817. public static function propertyExists($value, $property)
  48818. {
  48819. return property_exists($value, $property);
  48820. }
  48821. public static function propertyCount($value)
  48822. {
  48823. if (!is_object($value)) {
  48824. return 0;
  48825. }
  48826. return count(get_object_vars($value));
  48827. }
  48828. }
  48829. <?php
  48830. namespace JsonSchema\Constraints\TypeCheck;
  48831. interface TypeCheckInterface
  48832. {
  48833. public static function isObject($value);
  48834. public static function isArray($value);
  48835. public static function propertyGet($value, $property);
  48836. public static function propertySet(&$value, $property, $data);
  48837. public static function propertyExists($value, $property);
  48838. public static function propertyCount($value);
  48839. }
  48840. <?php
  48841. namespace JsonSchema\Constraints;
  48842. use JsonSchema\Entity\JsonPointer;
  48843. use JsonSchema\Exception\InvalidArgumentException;
  48844. use UnexpectedValueException as StandardUnexpectedValueException;
  48845. class TypeConstraint extends Constraint
  48846. {
  48847. public static $wording = array(
  48848. 'integer' => 'an integer',
  48849. 'number' => 'a number',
  48850. 'boolean' => 'a boolean',
  48851. 'object' => 'an object',
  48852. 'array' => 'an array',
  48853. 'string' => 'a string',
  48854. 'null' => 'a null',
  48855. 'any' => null,
  48856. 0 => null,
  48857. );
  48858. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48859. {
  48860. $type = isset($schema->type) ? $schema->type : null;
  48861. $isValid = false;
  48862. $wording = array();
  48863. if (is_array($type)) {
  48864. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48865. } elseif (is_object($type)) {
  48866. $this->checkUndefined($value, $type, $path);
  48867. return;
  48868. } else {
  48869. $isValid = $this->validateType($value, $type);
  48870. }
  48871. if ($isValid === false) {
  48872. if (!is_array($type)) {
  48873. $this->validateTypeNameWording($type);
  48874. $wording[] = self::$wording[$type];
  48875. }
  48876. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48877. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48878. }
  48879. }
  48880. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48881. {
  48882. foreach ($type as $tp) {
  48883. if (is_object($tp)) {
  48884. if (!$isValid) {
  48885. $validator = $this->factory->createInstanceFor('type');
  48886. $subSchema = new \stdClass();
  48887. $subSchema->type = $tp;
  48888. $validator->check($value, $subSchema, $path, null);
  48889. $error = $validator->getErrors();
  48890. $isValid = !(bool) $error;
  48891. $validTypesWording[] = self::$wording['object'];
  48892. }
  48893. } else {
  48894. $this->validateTypeNameWording($tp);
  48895. $validTypesWording[] = self::$wording[$tp];
  48896. if (!$isValid) {
  48897. $isValid = $this->validateType($value, $tp);
  48898. }
  48899. }
  48900. }
  48901. }
  48902. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48903. {
  48904. if ($listEnd === false || !isset($elements[1])) {
  48905. return implode($delimiter, $elements);
  48906. }
  48907. $lastElement = array_slice($elements, -1);
  48908. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48909. $implodedElements = array_merge(array($firsElements), $lastElement);
  48910. return join(" $listEnd ", $implodedElements);
  48911. }
  48912. protected function validateTypeNameWording($type)
  48913. {
  48914. if (!isset(self::$wording[$type])) {
  48915. throw new StandardUnexpectedValueException(
  48916. sprintf(
  48917. 'No wording for %s available, expected wordings are: [%s]',
  48918. var_export($type, true),
  48919. implode(', ', array_filter(self::$wording)))
  48920. );
  48921. }
  48922. }
  48923. protected function validateType(&$value, $type)
  48924. {
  48925. if (!$type) {
  48926. return true;
  48927. }
  48928. if ('any' === $type) {
  48929. return true;
  48930. }
  48931. if ('object' === $type) {
  48932. return $this->getTypeCheck()->isObject($value);
  48933. }
  48934. if ('array' === $type) {
  48935. return $this->getTypeCheck()->isArray($value);
  48936. }
  48937. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48938. if ('integer' === $type) {
  48939. if ($coerce) {
  48940. $value = $this->toInteger($value);
  48941. }
  48942. return is_int($value);
  48943. }
  48944. if ('number' === $type) {
  48945. if ($coerce) {
  48946. $value = $this->toNumber($value);
  48947. }
  48948. return is_numeric($value) && !is_string($value);
  48949. }
  48950. if ('boolean' === $type) {
  48951. if ($coerce) {
  48952. $value = $this->toBoolean($value);
  48953. }
  48954. return is_bool($value);
  48955. }
  48956. if ('string' === $type) {
  48957. return is_string($value);
  48958. }
  48959. if ('email' === $type) {
  48960. return is_string($value);
  48961. }
  48962. if ('null' === $type) {
  48963. return is_null($value);
  48964. }
  48965. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  48966. }
  48967. protected function toBoolean($value)
  48968. {
  48969. if ($value === 'true') {
  48970. return true;
  48971. }
  48972. if ($value === 'false') {
  48973. return false;
  48974. }
  48975. return $value;
  48976. }
  48977. protected function toNumber($value)
  48978. {
  48979. if (is_numeric($value)) {
  48980. return $value + 0;
  48981. }
  48982. return $value;
  48983. }
  48984. protected function toInteger($value)
  48985. {
  48986. if (is_numeric($value) && (int) $value == $value) {
  48987. return (int) $value;
  48988. }
  48989. return $value;
  48990. }
  48991. }
  48992. <?php
  48993. namespace JsonSchema\Constraints;
  48994. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  48995. use JsonSchema\Entity\JsonPointer;
  48996. use JsonSchema\Exception\ValidationException;
  48997. use JsonSchema\Uri\UriResolver;
  48998. class UndefinedConstraint extends Constraint
  48999. {
  49000. protected $appliedDefaults = array();
  49001. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  49002. {
  49003. if (is_null($schema) || !is_object($schema)) {
  49004. return;
  49005. }
  49006. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  49007. if ($fromDefault) {
  49008. $path->setFromDefault();
  49009. }
  49010. $this->validateCommonProperties($value, $schema, $path, $i);
  49011. $this->validateOfProperties($value, $schema, $path, '');
  49012. $this->validateTypes($value, $schema, $path, $i);
  49013. }
  49014. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  49015. {
  49016. if ($this->getTypeCheck()->isArray($value)) {
  49017. $this->checkArray($value, $schema, $path, $i);
  49018. }
  49019. if (LooseTypeCheck::isObject($value)) {
  49020. $this->checkObject(
  49021. $value,
  49022. $schema,
  49023. $path,
  49024. isset($schema->properties) ? $schema->properties : null,
  49025. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  49026. isset($schema->patternProperties) ? $schema->patternProperties : null,
  49027. $this->appliedDefaults
  49028. );
  49029. }
  49030. if (is_string($value)) {
  49031. $this->checkString($value, $schema, $path, $i);
  49032. }
  49033. if (is_numeric($value)) {
  49034. $this->checkNumber($value, $schema, $path, $i);
  49035. }
  49036. if (isset($schema->enum)) {
  49037. $this->checkEnum($value, $schema, $path, $i);
  49038. }
  49039. }
  49040. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  49041. {
  49042. if (isset($schema->extends)) {
  49043. if (is_string($schema->extends)) {
  49044. $schema->extends = $this->validateUri($schema, $schema->extends);
  49045. }
  49046. if (is_array($schema->extends)) {
  49047. foreach ($schema->extends as $extends) {
  49048. $this->checkUndefined($value, $extends, $path, $i);
  49049. }
  49050. } else {
  49051. $this->checkUndefined($value, $schema->extends, $path, $i);
  49052. }
  49053. }
  49054. if (!$path->fromDefault()) {
  49055. $this->applyDefaultValues($value, $schema, $path);
  49056. }
  49057. if ($this->getTypeCheck()->isObject($value)) {
  49058. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  49059. foreach ($schema->required as $required) {
  49060. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  49061. $this->addError(
  49062. $this->incrementPath($path ?: new JsonPointer(''), $required),
  49063. 'The property ' . $required . ' is required',
  49064. 'required'
  49065. );
  49066. }
  49067. }
  49068. } elseif (isset($schema->required) && !is_array($schema->required)) {
  49069. if ($schema->required && $value instanceof self) {
  49070. $propertyPaths = $path->getPropertyPaths();
  49071. $propertyName = end($propertyPaths);
  49072. $this->addError(
  49073. $path,
  49074. 'The property ' . $propertyName . ' is required',
  49075. 'required'
  49076. );
  49077. }
  49078. }
  49079. }
  49080. if (!($value instanceof self)) {
  49081. $this->checkType($value, $schema, $path, $i);
  49082. }
  49083. if (isset($schema->disallow)) {
  49084. $initErrors = $this->getErrors();
  49085. $typeSchema = new \stdClass();
  49086. $typeSchema->type = $schema->disallow;
  49087. $this->checkType($value, $typeSchema, $path);
  49088. if (count($this->getErrors()) == count($initErrors)) {
  49089. $this->addError($path, 'Disallowed value was matched', 'disallow');
  49090. } else {
  49091. $this->errors = $initErrors;
  49092. }
  49093. }
  49094. if (isset($schema->not)) {
  49095. $initErrors = $this->getErrors();
  49096. $this->checkUndefined($value, $schema->not, $path, $i);
  49097. if (count($this->getErrors()) == count($initErrors)) {
  49098. $this->addError($path, 'Matched a schema which it should not', 'not');
  49099. } else {
  49100. $this->errors = $initErrors;
  49101. }
  49102. }
  49103. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  49104. $this->validateDependencies($value, $schema->dependencies, $path);
  49105. }
  49106. }
  49107. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  49108. {
  49109. if (!$requiredOnly) {
  49110. return true;
  49111. }
  49112. if (
  49113. $name !== null
  49114. && isset($parentSchema->required)
  49115. && is_array($parentSchema->required)
  49116. && in_array($name, $parentSchema->required)
  49117. ) {
  49118. return true;
  49119. }
  49120. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  49121. return true;
  49122. }
  49123. return false;
  49124. }
  49125. protected function applyDefaultValues(&$value, $schema, $path)
  49126. {
  49127. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  49128. return;
  49129. }
  49130. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  49131. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  49132. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  49133. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  49134. if (
  49135. !LooseTypeCheck::propertyExists($value, $currentProperty)
  49136. && property_exists($propertyDefinition, 'default')
  49137. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  49138. ) {
  49139. if (is_object($propertyDefinition->default)) {
  49140. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  49141. } else {
  49142. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  49143. }
  49144. $this->appliedDefaults[] = $currentProperty;
  49145. }
  49146. }
  49147. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  49148. $items = array();
  49149. if (LooseTypeCheck::isArray($schema->items)) {
  49150. $items = $schema->items;
  49151. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  49152. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  49153. }
  49154. foreach ($items as $currentItem => $itemDefinition) {
  49155. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  49156. if (
  49157. !array_key_exists($currentItem, $value)
  49158. && property_exists($itemDefinition, 'default')
  49159. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  49160. if (is_object($itemDefinition->default)) {
  49161. $value[$currentItem] = clone $itemDefinition->default;
  49162. } else {
  49163. $value[$currentItem] = $itemDefinition->default;
  49164. }
  49165. }
  49166. $path->setFromDefault();
  49167. }
  49168. } elseif (
  49169. $value instanceof self
  49170. && property_exists($schema, 'default')
  49171. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  49172. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  49173. $path->setFromDefault();
  49174. }
  49175. }
  49176. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  49177. {
  49178. if ($value instanceof self) {
  49179. return;
  49180. }
  49181. if (isset($schema->allOf)) {
  49182. $isValid = true;
  49183. foreach ($schema->allOf as $allOf) {
  49184. $initErrors = $this->getErrors();
  49185. $this->checkUndefined($value, $allOf, $path, $i);
  49186. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  49187. }
  49188. if (!$isValid) {
  49189. $this->addError($path, 'Failed to match all schemas', 'allOf');
  49190. }
  49191. }
  49192. if (isset($schema->anyOf)) {
  49193. $isValid = false;
  49194. $startErrors = $this->getErrors();
  49195. $caughtException = null;
  49196. foreach ($schema->anyOf as $anyOf) {
  49197. $initErrors = $this->getErrors();
  49198. try {
  49199. $this->checkUndefined($value, $anyOf, $path, $i);
  49200. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  49201. break;
  49202. }
  49203. } catch (ValidationException $e) {
  49204. $isValid = false;
  49205. }
  49206. }
  49207. if (!$isValid) {
  49208. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  49209. } else {
  49210. $this->errors = $startErrors;
  49211. }
  49212. }
  49213. if (isset($schema->oneOf)) {
  49214. $allErrors = array();
  49215. $matchedSchemas = 0;
  49216. $startErrors = $this->getErrors();
  49217. foreach ($schema->oneOf as $oneOf) {
  49218. try {
  49219. $this->errors = array();
  49220. $this->checkUndefined($value, $oneOf, $path, $i);
  49221. if (count($this->getErrors()) == 0) {
  49222. $matchedSchemas++;
  49223. }
  49224. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  49225. } catch (ValidationException $e) {
  49226. }
  49227. }
  49228. if ($matchedSchemas !== 1) {
  49229. $this->addErrors(array_merge($allErrors, $startErrors));
  49230. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  49231. } else {
  49232. $this->errors = $startErrors;
  49233. }
  49234. }
  49235. }
  49236. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  49237. {
  49238. foreach ($dependencies as $key => $dependency) {
  49239. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  49240. if (is_string($dependency)) {
  49241. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  49242. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  49243. }
  49244. } elseif (is_array($dependency)) {
  49245. foreach ($dependency as $d) {
  49246. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  49247. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  49248. }
  49249. }
  49250. } elseif (is_object($dependency)) {
  49251. $this->checkUndefined($value, $dependency, $path, $i);
  49252. }
  49253. }
  49254. }
  49255. }
  49256. protected function validateUri($schema, $schemaUri = null)
  49257. {
  49258. $resolver = new UriResolver();
  49259. $retriever = $this->factory->getUriRetriever();
  49260. $jsonSchema = null;
  49261. if ($resolver->isValid($schemaUri)) {
  49262. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  49263. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  49264. }
  49265. return $jsonSchema;
  49266. }
  49267. }
  49268. <?php
  49269. namespace JsonSchema\Entity;
  49270. use JsonSchema\Exception\InvalidArgumentException;
  49271. class JsonPointer
  49272. {
  49273. private $filename;
  49274. private $propertyPaths = array();
  49275. private $fromDefault = false;
  49276. public function __construct($value)
  49277. {
  49278. if (!is_string($value)) {
  49279. throw new InvalidArgumentException('Ref value must be a string');
  49280. }
  49281. $splitRef = explode('#', $value, 2);
  49282. $this->filename = $splitRef[0];
  49283. if (array_key_exists(1, $splitRef)) {
  49284. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  49285. }
  49286. }
  49287. private function decodePropertyPaths($propertyPathString)
  49288. {
  49289. $paths = array();
  49290. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  49291. $path = $this->decodePath($path);
  49292. if (is_string($path) && '' !== $path) {
  49293. $paths[] = $path;
  49294. }
  49295. }
  49296. return $paths;
  49297. }
  49298. private function encodePropertyPaths()
  49299. {
  49300. return array_map(
  49301. array($this, 'encodePath'),
  49302. $this->getPropertyPaths()
  49303. );
  49304. }
  49305. private function decodePath($path)
  49306. {
  49307. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  49308. }
  49309. private function encodePath($path)
  49310. {
  49311. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  49312. }
  49313. public function getFilename()
  49314. {
  49315. return $this->filename;
  49316. }
  49317. public function getPropertyPaths()
  49318. {
  49319. return $this->propertyPaths;
  49320. }
  49321. public function withPropertyPaths(array $propertyPaths)
  49322. {
  49323. $new = clone $this;
  49324. $new->propertyPaths = $propertyPaths;
  49325. return $new;
  49326. }
  49327. public function getPropertyPathAsString()
  49328. {
  49329. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  49330. }
  49331. public function __toString()
  49332. {
  49333. return $this->getFilename() . $this->getPropertyPathAsString();
  49334. }
  49335. public function setFromDefault()
  49336. {
  49337. $this->fromDefault = true;
  49338. }
  49339. public function fromDefault()
  49340. {
  49341. return $this->fromDefault;
  49342. }
  49343. }
  49344. <?php
  49345. namespace JsonSchema\Exception;
  49346. interface ExceptionInterface
  49347. {
  49348. }
  49349. <?php
  49350. namespace JsonSchema\Exception;
  49351. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  49352. {
  49353. }
  49354. <?php
  49355. namespace JsonSchema\Exception;
  49356. class InvalidConfigException extends RuntimeException
  49357. {
  49358. }
  49359. <?php
  49360. namespace JsonSchema\Exception;
  49361. class InvalidSchemaException extends RuntimeException
  49362. {
  49363. }
  49364. <?php
  49365. namespace JsonSchema\Exception;
  49366. class InvalidSchemaMediaTypeException extends RuntimeException
  49367. {
  49368. }
  49369. <?php
  49370. namespace JsonSchema\Exception;
  49371. class InvalidSourceUriException extends InvalidArgumentException
  49372. {
  49373. }
  49374. <?php
  49375. namespace JsonSchema\Exception;
  49376. class JsonDecodingException extends RuntimeException
  49377. {
  49378. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  49379. {
  49380. switch ($code) {
  49381. case JSON_ERROR_DEPTH:
  49382. $message = 'The maximum stack depth has been exceeded';
  49383. break;
  49384. case JSON_ERROR_STATE_MISMATCH:
  49385. $message = 'Invalid or malformed JSON';
  49386. break;
  49387. case JSON_ERROR_CTRL_CHAR:
  49388. $message = 'Control character error, possibly incorrectly encoded';
  49389. break;
  49390. case JSON_ERROR_UTF8:
  49391. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  49392. break;
  49393. case JSON_ERROR_SYNTAX:
  49394. $message = 'JSON syntax is malformed';
  49395. break;
  49396. default:
  49397. $message = 'Syntax error';
  49398. }
  49399. parent::__construct($message, $code, $previous);
  49400. }
  49401. }
  49402. <?php
  49403. namespace JsonSchema\Exception;
  49404. class ResourceNotFoundException extends RuntimeException
  49405. {
  49406. }
  49407. <?php
  49408. namespace JsonSchema\Exception;
  49409. class RuntimeException extends \RuntimeException implements ExceptionInterface
  49410. {
  49411. }
  49412. <?php
  49413. namespace JsonSchema\Exception;
  49414. class UnresolvableJsonPointerException extends InvalidArgumentException
  49415. {
  49416. }
  49417. <?php
  49418. namespace JsonSchema\Exception;
  49419. class UriResolverException extends RuntimeException
  49420. {
  49421. }
  49422. <?php
  49423. namespace JsonSchema\Exception;
  49424. class ValidationException extends RuntimeException
  49425. {
  49426. }
  49427. <?php
  49428. namespace JsonSchema\Iterator;
  49429. class ObjectIterator implements \Iterator, \Countable
  49430. {
  49431. private $object;
  49432. private $position = 0;
  49433. private $data = array();
  49434. private $initialized = false;
  49435. public function __construct($object)
  49436. {
  49437. $this->object = $object;
  49438. }
  49439. public function current()
  49440. {
  49441. $this->initialize();
  49442. return $this->data[$this->position];
  49443. }
  49444. public function next()
  49445. {
  49446. $this->initialize();
  49447. $this->position++;
  49448. }
  49449. public function key()
  49450. {
  49451. $this->initialize();
  49452. return $this->position;
  49453. }
  49454. public function valid()
  49455. {
  49456. $this->initialize();
  49457. return isset($this->data[$this->position]);
  49458. }
  49459. public function rewind()
  49460. {
  49461. $this->initialize();
  49462. $this->position = 0;
  49463. }
  49464. public function count()
  49465. {
  49466. $this->initialize();
  49467. return count($this->data);
  49468. }
  49469. private function initialize()
  49470. {
  49471. if (!$this->initialized) {
  49472. $this->data = $this->buildDataFromObject($this->object);
  49473. $this->initialized = true;
  49474. }
  49475. }
  49476. private function buildDataFromObject($object)
  49477. {
  49478. $result = array();
  49479. $stack = new \SplStack();
  49480. $stack->push($object);
  49481. while (!$stack->isEmpty()) {
  49482. $current = $stack->pop();
  49483. if (is_object($current)) {
  49484. array_push($result, $current);
  49485. }
  49486. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49487. if (is_object($propertyValue) || is_array($propertyValue)) {
  49488. $stack->push($propertyValue);
  49489. }
  49490. }
  49491. }
  49492. return $result;
  49493. }
  49494. private function getDataFromItem($item)
  49495. {
  49496. if (!is_object($item) && !is_array($item)) {
  49497. return array();
  49498. }
  49499. return is_object($item) ? get_object_vars($item) : $item;
  49500. }
  49501. }
  49502. <?php
  49503. namespace JsonSchema;
  49504. class Rfc3339
  49505. {
  49506. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49507. public static function createFromString($string)
  49508. {
  49509. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49510. return null;
  49511. }
  49512. $dateAndTime = $matches[1];
  49513. $microseconds = $matches[2] ?: '.000000';
  49514. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49515. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49516. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49517. return $dateTime ?: null;
  49518. }
  49519. }
  49520. <?php
  49521. namespace JsonSchema;
  49522. use JsonSchema\Constraints\BaseConstraint;
  49523. use JsonSchema\Entity\JsonPointer;
  49524. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49525. use JsonSchema\Uri\UriResolver;
  49526. use JsonSchema\Uri\UriRetriever;
  49527. class SchemaStorage implements SchemaStorageInterface
  49528. {
  49529. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49530. protected $uriRetriever;
  49531. protected $uriResolver;
  49532. protected $schemas = array();
  49533. public function __construct(
  49534. UriRetrieverInterface $uriRetriever = null,
  49535. UriResolverInterface $uriResolver = null
  49536. ) {
  49537. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49538. $this->uriResolver = $uriResolver ?: new UriResolver();
  49539. }
  49540. public function getUriRetriever()
  49541. {
  49542. return $this->uriRetriever;
  49543. }
  49544. public function getUriResolver()
  49545. {
  49546. return $this->uriResolver;
  49547. }
  49548. public function addSchema($id, $schema = null)
  49549. {
  49550. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49551. $schema = $this->uriRetriever->retrieve($id);
  49552. }
  49553. if (is_array($schema)) {
  49554. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49555. }
  49556. if (is_object($schema) && property_exists($schema, 'id')) {
  49557. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49558. $schema->properties->id->format = 'uri-reference';
  49559. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49560. $schema->properties->id->format = 'uri-reference';
  49561. $schema->properties->{'$ref'}->format = 'uri-reference';
  49562. }
  49563. }
  49564. $this->expandRefs($schema, $id);
  49565. $this->schemas[$id] = $schema;
  49566. }
  49567. private function expandRefs(&$schema, $base = null)
  49568. {
  49569. if (!is_object($schema)) {
  49570. if (is_array($schema)) {
  49571. foreach ($schema as &$member) {
  49572. $this->expandRefs($member, $base);
  49573. }
  49574. }
  49575. return;
  49576. }
  49577. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49578. $base = $this->uriResolver->resolve($schema->id, $base);
  49579. }
  49580. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49581. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49582. $schema->{'$ref'} = (string) $refPointer;
  49583. }
  49584. foreach ($schema as &$member) {
  49585. $this->expandRefs($member, $base);
  49586. }
  49587. }
  49588. public function getSchema($id)
  49589. {
  49590. if (!array_key_exists($id, $this->schemas)) {
  49591. $this->addSchema($id);
  49592. }
  49593. return $this->schemas[$id];
  49594. }
  49595. public function resolveRef($ref)
  49596. {
  49597. $jsonPointer = new JsonPointer($ref);
  49598. $fileName = $jsonPointer->getFilename();
  49599. if (!strlen($fileName)) {
  49600. throw new UnresolvableJsonPointerException(sprintf(
  49601. "Could not resolve fragment '%s': no file is defined",
  49602. $jsonPointer->getPropertyPathAsString()
  49603. ));
  49604. }
  49605. $refSchema = $this->getSchema($fileName);
  49606. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49607. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49608. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49609. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49610. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49611. } else {
  49612. throw new UnresolvableJsonPointerException(sprintf(
  49613. 'File: %s is found, but could not resolve fragment: %s',
  49614. $jsonPointer->getFilename(),
  49615. $jsonPointer->getPropertyPathAsString()
  49616. ));
  49617. }
  49618. }
  49619. return $refSchema;
  49620. }
  49621. public function resolveRefSchema($refSchema)
  49622. {
  49623. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49624. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49625. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49626. unset($refSchema->{'$ref'});
  49627. }
  49628. return $refSchema;
  49629. }
  49630. }
  49631. <?php
  49632. namespace JsonSchema;
  49633. interface SchemaStorageInterface
  49634. {
  49635. public function addSchema($id, $schema = null);
  49636. public function getSchema($id);
  49637. public function resolveRef($ref);
  49638. public function resolveRefSchema($refSchema);
  49639. }
  49640. <?php
  49641. namespace JsonSchema\Uri\Retrievers;
  49642. abstract class AbstractRetriever implements UriRetrieverInterface
  49643. {
  49644. protected $contentType;
  49645. public function getContentType()
  49646. {
  49647. return $this->contentType;
  49648. }
  49649. }
  49650. <?php
  49651. namespace JsonSchema\Uri\Retrievers;
  49652. use JsonSchema\Exception\RuntimeException;
  49653. use JsonSchema\Validator;
  49654. class Curl extends AbstractRetriever
  49655. {
  49656. protected $messageBody;
  49657. public function __construct()
  49658. {
  49659. if (!function_exists('curl_init')) {
  49660. throw new RuntimeException('cURL not installed');
  49661. }
  49662. }
  49663. public function retrieve($uri)
  49664. {
  49665. $ch = curl_init();
  49666. curl_setopt($ch, CURLOPT_URL, $uri);
  49667. curl_setopt($ch, CURLOPT_HEADER, true);
  49668. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49669. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49670. $response = curl_exec($ch);
  49671. if (false === $response) {
  49672. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49673. }
  49674. $this->fetchMessageBody($response);
  49675. $this->fetchContentType($response);
  49676. curl_close($ch);
  49677. return $this->messageBody;
  49678. }
  49679. private function fetchMessageBody($response)
  49680. {
  49681. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49682. $this->messageBody = $match[1];
  49683. }
  49684. protected function fetchContentType($response)
  49685. {
  49686. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49687. $this->contentType = trim($match[1]);
  49688. return true;
  49689. }
  49690. return false;
  49691. }
  49692. }
  49693. <?php
  49694. namespace JsonSchema\Uri\Retrievers;
  49695. use JsonSchema\Exception\ResourceNotFoundException;
  49696. class FileGetContents extends AbstractRetriever
  49697. {
  49698. protected $messageBody;
  49699. public function retrieve($uri)
  49700. {
  49701. $errorMessage = null;
  49702. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49703. $errorMessage = $errstr;
  49704. });
  49705. $response = file_get_contents($uri);
  49706. restore_error_handler();
  49707. if ($errorMessage) {
  49708. throw new ResourceNotFoundException($errorMessage);
  49709. }
  49710. if (false === $response) {
  49711. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49712. }
  49713. if ($response == ''
  49714. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49715. ) {
  49716. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49717. }
  49718. $this->messageBody = $response;
  49719. if (!empty($http_response_header)) {
  49720. $this->fetchContentType($http_response_header);
  49721. } else {
  49722. $this->contentType = null;
  49723. }
  49724. return $this->messageBody;
  49725. }
  49726. private function fetchContentType(array $headers)
  49727. {
  49728. foreach ($headers as $header) {
  49729. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49730. return true;
  49731. }
  49732. }
  49733. return false;
  49734. }
  49735. protected static function getContentTypeMatchInHeader($header)
  49736. {
  49737. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49738. return trim($match[1]);
  49739. }
  49740. return null;
  49741. }
  49742. }
  49743. <?php
  49744. namespace JsonSchema\Uri\Retrievers;
  49745. use JsonSchema\Validator;
  49746. class PredefinedArray extends AbstractRetriever
  49747. {
  49748. private $schemas;
  49749. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49750. {
  49751. $this->schemas = $schemas;
  49752. $this->contentType = $contentType;
  49753. }
  49754. public function retrieve($uri)
  49755. {
  49756. if (!array_key_exists($uri, $this->schemas)) {
  49757. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49758. 'The JSON schema "%s" was not found.',
  49759. $uri
  49760. ));
  49761. }
  49762. return $this->schemas[$uri];
  49763. }
  49764. }
  49765. <?php
  49766. namespace JsonSchema\Uri\Retrievers;
  49767. interface UriRetrieverInterface
  49768. {
  49769. public function retrieve($uri);
  49770. public function getContentType();
  49771. }
  49772. <?php
  49773. namespace JsonSchema\Uri;
  49774. use JsonSchema\Exception\UriResolverException;
  49775. use JsonSchema\UriResolverInterface;
  49776. class UriResolver implements UriResolverInterface
  49777. {
  49778. public function parse($uri)
  49779. {
  49780. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49781. $components = array();
  49782. if (5 < count($match)) {
  49783. $components = array(
  49784. 'scheme' => $match[2],
  49785. 'authority' => $match[4],
  49786. 'path' => $match[5]
  49787. );
  49788. }
  49789. if (7 < count($match)) {
  49790. $components['query'] = $match[7];
  49791. }
  49792. if (9 < count($match)) {
  49793. $components['fragment'] = $match[9];
  49794. }
  49795. return $components;
  49796. }
  49797. public function generate(array $components)
  49798. {
  49799. $uri = $components['scheme'] . '://'
  49800. . $components['authority']
  49801. . $components['path'];
  49802. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49803. $uri .= '?' . $components['query'];
  49804. }
  49805. if (array_key_exists('fragment', $components)) {
  49806. $uri .= '#' . $components['fragment'];
  49807. }
  49808. return $uri;
  49809. }
  49810. public function resolve($uri, $baseUri = null)
  49811. {
  49812. if (
  49813. !is_null($baseUri) &&
  49814. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49815. !preg_match('|^[^/]+://|u', $baseUri)
  49816. ) {
  49817. if (is_file($baseUri)) {
  49818. $baseUri = 'file://' . realpath($baseUri);
  49819. } elseif (is_dir($baseUri)) {
  49820. $baseUri = 'file://' . realpath($baseUri) . '/';
  49821. } else {
  49822. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49823. }
  49824. }
  49825. if ($uri == '') {
  49826. return $baseUri;
  49827. }
  49828. $components = $this->parse($uri);
  49829. $path = $components['path'];
  49830. if (!empty($components['scheme'])) {
  49831. return $uri;
  49832. }
  49833. $baseComponents = $this->parse($baseUri);
  49834. $basePath = $baseComponents['path'];
  49835. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49836. if (isset($components['fragment'])) {
  49837. $baseComponents['fragment'] = $components['fragment'];
  49838. }
  49839. return $this->generate($baseComponents);
  49840. }
  49841. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49842. {
  49843. $relativePath = self::normalizePath($relativePath);
  49844. if ($relativePath == '') {
  49845. return $basePath;
  49846. }
  49847. if ($relativePath[0] == '/') {
  49848. return $relativePath;
  49849. }
  49850. $basePathSegments = explode('/', $basePath);
  49851. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49852. $numLevelUp = strlen($match[0]) /3 + 1;
  49853. if ($numLevelUp >= count($basePathSegments)) {
  49854. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49855. }
  49856. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49857. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49858. return implode('/', $basePathSegments) . '/' . $path;
  49859. }
  49860. private static function normalizePath($path)
  49861. {
  49862. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49863. $path = preg_replace('|//|', '/', $path);
  49864. return $path;
  49865. }
  49866. public function isValid($uri)
  49867. {
  49868. $components = $this->parse($uri);
  49869. return !empty($components);
  49870. }
  49871. }
  49872. <?php
  49873. namespace JsonSchema\Uri;
  49874. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49875. use JsonSchema\Exception\JsonDecodingException;
  49876. use JsonSchema\Exception\ResourceNotFoundException;
  49877. use JsonSchema\Uri\Retrievers\FileGetContents;
  49878. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49879. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49880. use JsonSchema\Validator;
  49881. class UriRetriever implements BaseUriRetrieverInterface
  49882. {
  49883. protected $translationMap = array(
  49884. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49885. );
  49886. protected $allowedInvalidContentTypeEndpoints = array(
  49887. 'http://json-schema.org/',
  49888. 'https://json-schema.org/'
  49889. );
  49890. protected $uriRetriever = null;
  49891. private $schemaCache = array();
  49892. public function addInvalidContentTypeEndpoint($endpoint)
  49893. {
  49894. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  49895. }
  49896. public function confirmMediaType($uriRetriever, $uri)
  49897. {
  49898. $contentType = $uriRetriever->getContentType();
  49899. if (is_null($contentType)) {
  49900. return;
  49901. }
  49902. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49903. return;
  49904. }
  49905. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  49906. if (strpos($uri, $endpoint) === 0) {
  49907. return true;
  49908. }
  49909. }
  49910. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49911. }
  49912. public function getUriRetriever()
  49913. {
  49914. if (is_null($this->uriRetriever)) {
  49915. $this->setUriRetriever(new FileGetContents());
  49916. }
  49917. return $this->uriRetriever;
  49918. }
  49919. public function resolvePointer($jsonSchema, $uri)
  49920. {
  49921. $resolver = new UriResolver();
  49922. $parsed = $resolver->parse($uri);
  49923. if (empty($parsed['fragment'])) {
  49924. return $jsonSchema;
  49925. }
  49926. $path = explode('/', $parsed['fragment']);
  49927. while ($path) {
  49928. $pathElement = array_shift($path);
  49929. if (!empty($pathElement)) {
  49930. $pathElement = str_replace('~1', '/', $pathElement);
  49931. $pathElement = str_replace('~0', '~', $pathElement);
  49932. if (!empty($jsonSchema->$pathElement)) {
  49933. $jsonSchema = $jsonSchema->$pathElement;
  49934. } else {
  49935. throw new ResourceNotFoundException(
  49936. 'Fragment "' . $parsed['fragment'] . '" not found'
  49937. . ' in ' . $uri
  49938. );
  49939. }
  49940. if (!is_object($jsonSchema)) {
  49941. throw new ResourceNotFoundException(
  49942. 'Fragment part "' . $pathElement . '" is no object '
  49943. . ' in ' . $uri
  49944. );
  49945. }
  49946. }
  49947. }
  49948. return $jsonSchema;
  49949. }
  49950. public function retrieve($uri, $baseUri = null, $translate = true)
  49951. {
  49952. $resolver = new UriResolver();
  49953. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49954. $arParts = $resolver->parse($resolvedUri);
  49955. if (isset($arParts['fragment'])) {
  49956. unset($arParts['fragment']);
  49957. $fetchUri = $resolver->generate($arParts);
  49958. }
  49959. if ($translate) {
  49960. $fetchUri = $this->translate($fetchUri);
  49961. }
  49962. $jsonSchema = $this->loadSchema($fetchUri);
  49963. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  49964. if ($jsonSchema instanceof \stdClass) {
  49965. $jsonSchema->id = $resolvedUri;
  49966. }
  49967. return $jsonSchema;
  49968. }
  49969. protected function loadSchema($fetchUri)
  49970. {
  49971. if (isset($this->schemaCache[$fetchUri])) {
  49972. return $this->schemaCache[$fetchUri];
  49973. }
  49974. $uriRetriever = $this->getUriRetriever();
  49975. $contents = $this->uriRetriever->retrieve($fetchUri);
  49976. $this->confirmMediaType($uriRetriever, $fetchUri);
  49977. $jsonSchema = json_decode($contents);
  49978. if (JSON_ERROR_NONE < $error = json_last_error()) {
  49979. throw new JsonDecodingException($error);
  49980. }
  49981. $this->schemaCache[$fetchUri] = $jsonSchema;
  49982. return $jsonSchema;
  49983. }
  49984. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  49985. {
  49986. $this->uriRetriever = $uriRetriever;
  49987. return $this;
  49988. }
  49989. public function parse($uri)
  49990. {
  49991. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49992. $components = array();
  49993. if (5 < count($match)) {
  49994. $components = array(
  49995. 'scheme' => $match[2],
  49996. 'authority' => $match[4],
  49997. 'path' => $match[5]
  49998. );
  49999. }
  50000. if (7 < count($match)) {
  50001. $components['query'] = $match[7];
  50002. }
  50003. if (9 < count($match)) {
  50004. $components['fragment'] = $match[9];
  50005. }
  50006. return $components;
  50007. }
  50008. public function generate(array $components)
  50009. {
  50010. $uri = $components['scheme'] . '://'
  50011. . $components['authority']
  50012. . $components['path'];
  50013. if (array_key_exists('query', $components)) {
  50014. $uri .= $components['query'];
  50015. }
  50016. if (array_key_exists('fragment', $components)) {
  50017. $uri .= $components['fragment'];
  50018. }
  50019. return $uri;
  50020. }
  50021. public function resolve($uri, $baseUri = null)
  50022. {
  50023. $components = $this->parse($uri);
  50024. $path = $components['path'];
  50025. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  50026. return $uri;
  50027. }
  50028. $baseComponents = $this->parse($baseUri);
  50029. $basePath = $baseComponents['path'];
  50030. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  50031. return $this->generate($baseComponents);
  50032. }
  50033. public function isValid($uri)
  50034. {
  50035. $components = $this->parse($uri);
  50036. return !empty($components);
  50037. }
  50038. public function setTranslation($from, $to)
  50039. {
  50040. $this->translationMap[$from] = $to;
  50041. }
  50042. public function translate($uri)
  50043. {
  50044. foreach ($this->translationMap as $from => $to) {
  50045. $uri = preg_replace($from, $to, $uri);
  50046. }
  50047. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  50048. return $uri;
  50049. }
  50050. }
  50051. <?php
  50052. namespace JsonSchema;
  50053. interface UriResolverInterface
  50054. {
  50055. public function resolve($uri, $baseUri = null);
  50056. }
  50057. <?php
  50058. namespace JsonSchema;
  50059. interface UriRetrieverInterface
  50060. {
  50061. public function retrieve($uri, $baseUri = null);
  50062. }
  50063. <?php
  50064. namespace JsonSchema;
  50065. use JsonSchema\Constraints\BaseConstraint;
  50066. use JsonSchema\Constraints\Constraint;
  50067. class Validator extends BaseConstraint
  50068. {
  50069. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  50070. const ERROR_NONE = 0x00000000;
  50071. const ERROR_ALL = 0xFFFFFFFF;
  50072. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  50073. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  50074. public function validate(&$value, $schema = null, $checkMode = null)
  50075. {
  50076. if (is_array($schema)) {
  50077. $schema = self::arrayToObjectRecursive($schema);
  50078. }
  50079. $initialCheckMode = $this->factory->getConfig();
  50080. if ($checkMode !== null) {
  50081. $this->factory->setConfig($checkMode);
  50082. }
  50083. if (is_object($schema) && property_exists($schema, 'id')) {
  50084. $schemaURI = $schema->id;
  50085. } else {
  50086. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  50087. }
  50088. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  50089. $validator = $this->factory->createInstanceFor('schema');
  50090. $validator->check(
  50091. $value,
  50092. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  50093. );
  50094. $this->factory->setConfig($initialCheckMode);
  50095. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  50096. return $validator->getErrorMask();
  50097. }
  50098. public function check($value, $schema)
  50099. {
  50100. return $this->validate($value, $schema);
  50101. }
  50102. public function coerce(&$value, $schema)
  50103. {
  50104. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  50105. }
  50106. }
  50107. Copyright (C) 2015 Composer
  50108. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50109. this software and associated documentation files (the "Software"), to deal in
  50110. the Software without restriction, including without limitation the rights to
  50111. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50112. of the Software, and to permit persons to whom the Software is furnished to do
  50113. so, subject to the following conditions:
  50114. The above copyright notice and this permission notice shall be included in all
  50115. copies or substantial portions of the Software.
  50116. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50117. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50118. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50119. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50120. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50121. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50122. SOFTWARE.
  50123. <?php
  50124. namespace Composer\Spdx;
  50125. class SpdxLicenses
  50126. {
  50127. const LICENSES_FILE = 'spdx-licenses.json';
  50128. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  50129. private $licenses;
  50130. private $licensesExpression;
  50131. private $exceptions;
  50132. private $exceptionsExpression;
  50133. public function __construct()
  50134. {
  50135. $this->loadLicenses();
  50136. $this->loadExceptions();
  50137. }
  50138. public function getLicenseByIdentifier($identifier)
  50139. {
  50140. $key = strtolower($identifier);
  50141. if (!isset($this->licenses[$key])) {
  50142. return;
  50143. }
  50144. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  50145. return array(
  50146. $name,
  50147. $isOsiApproved,
  50148. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  50149. $isDeprecatedLicenseId,
  50150. );
  50151. }
  50152. public function getLicenses()
  50153. {
  50154. return $this->licenses;
  50155. }
  50156. public function getExceptionByIdentifier($identifier)
  50157. {
  50158. $key = strtolower($identifier);
  50159. if (!isset($this->exceptions[$key])) {
  50160. return;
  50161. }
  50162. list($identifier, $name) = $this->exceptions[$key];
  50163. return array(
  50164. $name,
  50165. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  50166. );
  50167. }
  50168. public function getIdentifierByName($name)
  50169. {
  50170. foreach ($this->licenses as $licenseData) {
  50171. if ($licenseData[1] === $name) {
  50172. return $licenseData[0];
  50173. }
  50174. }
  50175. foreach ($this->exceptions as $licenseData) {
  50176. if ($licenseData[1] === $name) {
  50177. return $licenseData[0];
  50178. }
  50179. }
  50180. }
  50181. public function isOsiApprovedByIdentifier($identifier)
  50182. {
  50183. return $this->licenses[strtolower($identifier)][2];
  50184. }
  50185. public function isDeprecatedByIdentifier($identifier)
  50186. {
  50187. return $this->licenses[strtolower($identifier)][3];
  50188. }
  50189. public function validate($license)
  50190. {
  50191. if (is_array($license)) {
  50192. $count = count($license);
  50193. if ($count !== count(array_filter($license, 'is_string'))) {
  50194. throw new \InvalidArgumentException('Array of strings expected.');
  50195. }
  50196. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  50197. }
  50198. if (!is_string($license)) {
  50199. throw new \InvalidArgumentException(sprintf(
  50200. 'Array or String expected, %s given.',
  50201. gettype($license)
  50202. ));
  50203. }
  50204. return $this->isValidLicenseString($license);
  50205. }
  50206. public static function getResourcesDir()
  50207. {
  50208. return dirname(__DIR__) . '/res';
  50209. }
  50210. private function loadLicenses()
  50211. {
  50212. if (null !== $this->licenses) {
  50213. return;
  50214. }
  50215. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  50216. $this->licenses = array();
  50217. foreach (json_decode($json, true) as $identifier => $license) {
  50218. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  50219. }
  50220. }
  50221. private function loadExceptions()
  50222. {
  50223. if (null !== $this->exceptions) {
  50224. return;
  50225. }
  50226. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  50227. $this->exceptions = array();
  50228. foreach (json_decode($json, true) as $identifier => $exception) {
  50229. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  50230. }
  50231. }
  50232. private function getLicensesExpression()
  50233. {
  50234. if (null === $this->licensesExpression) {
  50235. $licenses = array_map('preg_quote', array_keys($this->licenses));
  50236. rsort($licenses);
  50237. $licenses = implode('|', $licenses);
  50238. $this->licensesExpression = $licenses;
  50239. }
  50240. return $this->licensesExpression;
  50241. }
  50242. private function getExceptionsExpression()
  50243. {
  50244. if (null === $this->exceptionsExpression) {
  50245. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  50246. rsort($exceptions);
  50247. $exceptions = implode('|', $exceptions);
  50248. $this->exceptionsExpression = $exceptions;
  50249. }
  50250. return $this->exceptionsExpression;
  50251. }
  50252. private function isValidLicenseString($license)
  50253. {
  50254. if (isset($this->licenses[strtolower($license)])) {
  50255. return true;
  50256. }
  50257. $licenses = $this->getLicensesExpression();
  50258. $exceptions = $this->getExceptionsExpression();
  50259. $regex = <<<REGEX
  50260. {
  50261. (?(DEFINE)
  50262. # idstring: 1*( ALPHA / DIGIT / - / . )
  50263. (?<idstring>[\pL\pN.-]{1,})
  50264. # license-id: taken from list
  50265. (?<licenseid>${licenses})
  50266. # license-exception-id: taken from list
  50267. (?<licenseexceptionid>${exceptions})
  50268. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  50269. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  50270. # simple-expresssion: license-id / license-id+ / license-ref
  50271. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  50272. # compound-expression: 1*(
  50273. # simple-expression /
  50274. # simple-expression WITH license-exception-id /
  50275. # compound-expression AND compound-expression /
  50276. # compound-expression OR compound-expression
  50277. # ) / ( compound-expression ) )
  50278. (?<compound_head>
  50279. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  50280. | \( \s* (?&compound_expression) \s* \)
  50281. )
  50282. (?<compound_expression>
  50283. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  50284. )
  50285. # license-expression: 1*1(simple-expression / compound-expression)
  50286. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  50287. ) # end of define
  50288. ^(NONE | NOASSERTION | (?&license_expression))$
  50289. }xi
  50290. REGEX;
  50291. $match = preg_match($regex, $license);
  50292. if (0 === $match) {
  50293. return false;
  50294. }
  50295. if (false === $match) {
  50296. throw new \RuntimeException('Regex failed to compile/run.');
  50297. }
  50298. return true;
  50299. }
  50300. }
  50301. Copyright (C) 2015 Composer
  50302. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50303. this software and associated documentation files (the "Software"), to deal in
  50304. the Software without restriction, including without limitation the rights to
  50305. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50306. of the Software, and to permit persons to whom the Software is furnished to do
  50307. so, subject to the following conditions:
  50308. The above copyright notice and this permission notice shall be included in all
  50309. copies or substantial portions of the Software.
  50310. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50311. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50312. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50313. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50314. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50315. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50316. SOFTWARE.
  50317. <?php
  50318. namespace Composer\Semver;
  50319. use Composer\Semver\Constraint\Constraint;
  50320. class Comparator
  50321. {
  50322. public static function greaterThan($version1, $version2)
  50323. {
  50324. return self::compare($version1, '>', $version2);
  50325. }
  50326. public static function greaterThanOrEqualTo($version1, $version2)
  50327. {
  50328. return self::compare($version1, '>=', $version2);
  50329. }
  50330. public static function lessThan($version1, $version2)
  50331. {
  50332. return self::compare($version1, '<', $version2);
  50333. }
  50334. public static function lessThanOrEqualTo($version1, $version2)
  50335. {
  50336. return self::compare($version1, '<=', $version2);
  50337. }
  50338. public static function equalTo($version1, $version2)
  50339. {
  50340. return self::compare($version1, '==', $version2);
  50341. }
  50342. public static function notEqualTo($version1, $version2)
  50343. {
  50344. return self::compare($version1, '!=', $version2);
  50345. }
  50346. public static function compare($version1, $operator, $version2)
  50347. {
  50348. $constraint = new Constraint($operator, $version2);
  50349. return $constraint->matches(new Constraint('==', $version1));
  50350. }
  50351. }
  50352. <?php
  50353. namespace Composer\Semver\Constraint;
  50354. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  50355. abstract class AbstractConstraint implements ConstraintInterface
  50356. {
  50357. protected $prettyString;
  50358. public function matches(ConstraintInterface $provider)
  50359. {
  50360. if ($provider instanceof $this) {
  50361. return $this->matchSpecific($provider);
  50362. }
  50363. return $provider->matches($this);
  50364. }
  50365. public function setPrettyString($prettyString)
  50366. {
  50367. $this->prettyString = $prettyString;
  50368. }
  50369. public function getPrettyString()
  50370. {
  50371. if ($this->prettyString) {
  50372. return $this->prettyString;
  50373. }
  50374. return $this->__toString();
  50375. }
  50376. }
  50377. <?php
  50378. namespace Composer\Semver\Constraint;
  50379. class Constraint implements ConstraintInterface
  50380. {
  50381. const OP_EQ = 0;
  50382. const OP_LT = 1;
  50383. const OP_LE = 2;
  50384. const OP_GT = 3;
  50385. const OP_GE = 4;
  50386. const OP_NE = 5;
  50387. private static $transOpStr = array(
  50388. '=' => self::OP_EQ,
  50389. '==' => self::OP_EQ,
  50390. '<' => self::OP_LT,
  50391. '<=' => self::OP_LE,
  50392. '>' => self::OP_GT,
  50393. '>=' => self::OP_GE,
  50394. '<>' => self::OP_NE,
  50395. '!=' => self::OP_NE,
  50396. );
  50397. private static $transOpInt = array(
  50398. self::OP_EQ => '==',
  50399. self::OP_LT => '<',
  50400. self::OP_LE => '<=',
  50401. self::OP_GT => '>',
  50402. self::OP_GE => '>=',
  50403. self::OP_NE => '!=',
  50404. );
  50405. protected $operator;
  50406. protected $version;
  50407. protected $prettyString;
  50408. public function matches(ConstraintInterface $provider)
  50409. {
  50410. if ($provider instanceof $this) {
  50411. return $this->matchSpecific($provider);
  50412. }
  50413. return $provider->matches($this);
  50414. }
  50415. public function setPrettyString($prettyString)
  50416. {
  50417. $this->prettyString = $prettyString;
  50418. }
  50419. public function getPrettyString()
  50420. {
  50421. if ($this->prettyString) {
  50422. return $this->prettyString;
  50423. }
  50424. return $this->__toString();
  50425. }
  50426. public static function getSupportedOperators()
  50427. {
  50428. return array_keys(self::$transOpStr);
  50429. }
  50430. public function __construct($operator, $version)
  50431. {
  50432. if (!isset(self::$transOpStr[$operator])) {
  50433. throw new \InvalidArgumentException(sprintf(
  50434. 'Invalid operator "%s" given, expected one of: %s',
  50435. $operator,
  50436. implode(', ', self::getSupportedOperators())
  50437. ));
  50438. }
  50439. $this->operator = self::$transOpStr[$operator];
  50440. $this->version = $version;
  50441. }
  50442. public function versionCompare($a, $b, $operator, $compareBranches = false)
  50443. {
  50444. if (!isset(self::$transOpStr[$operator])) {
  50445. throw new \InvalidArgumentException(sprintf(
  50446. 'Invalid operator "%s" given, expected one of: %s',
  50447. $operator,
  50448. implode(', ', self::getSupportedOperators())
  50449. ));
  50450. }
  50451. $aIsBranch = 'dev-' === substr($a, 0, 4);
  50452. $bIsBranch = 'dev-' === substr($b, 0, 4);
  50453. if ($aIsBranch && $bIsBranch) {
  50454. return $operator === '==' && $a === $b;
  50455. }
  50456. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  50457. return false;
  50458. }
  50459. return version_compare($a, $b, $operator);
  50460. }
  50461. public function matchSpecific(Constraint $provider, $compareBranches = false)
  50462. {
  50463. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  50464. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  50465. $isEqualOp = self::OP_EQ === $this->operator;
  50466. $isNonEqualOp = self::OP_NE === $this->operator;
  50467. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  50468. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  50469. if ($isNonEqualOp || $isProviderNonEqualOp) {
  50470. return !$isEqualOp && !$isProviderEqualOp
  50471. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  50472. }
  50473. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  50474. return true;
  50475. }
  50476. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  50477. if ($provider->version === $this->version
  50478. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  50479. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  50480. return false;
  50481. }
  50482. return true;
  50483. }
  50484. return false;
  50485. }
  50486. public function __toString()
  50487. {
  50488. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  50489. }
  50490. }
  50491. <?php
  50492. namespace Composer\Semver\Constraint;
  50493. interface ConstraintInterface
  50494. {
  50495. public function matches(ConstraintInterface $provider);
  50496. public function getPrettyString();
  50497. public function __toString();
  50498. }
  50499. <?php
  50500. namespace Composer\Semver\Constraint;
  50501. class EmptyConstraint implements ConstraintInterface
  50502. {
  50503. protected $prettyString;
  50504. public function matches(ConstraintInterface $provider)
  50505. {
  50506. return true;
  50507. }
  50508. public function setPrettyString($prettyString)
  50509. {
  50510. $this->prettyString = $prettyString;
  50511. }
  50512. public function getPrettyString()
  50513. {
  50514. if ($this->prettyString) {
  50515. return $this->prettyString;
  50516. }
  50517. return $this->__toString();
  50518. }
  50519. public function __toString()
  50520. {
  50521. return '[]';
  50522. }
  50523. }
  50524. <?php
  50525. namespace Composer\Semver\Constraint;
  50526. class MultiConstraint implements ConstraintInterface
  50527. {
  50528. protected $constraints;
  50529. protected $prettyString;
  50530. protected $conjunctive;
  50531. public function __construct(array $constraints, $conjunctive = true)
  50532. {
  50533. $this->constraints = $constraints;
  50534. $this->conjunctive = $conjunctive;
  50535. }
  50536. public function getConstraints()
  50537. {
  50538. return $this->constraints;
  50539. }
  50540. public function isConjunctive()
  50541. {
  50542. return $this->conjunctive;
  50543. }
  50544. public function isDisjunctive()
  50545. {
  50546. return !$this->conjunctive;
  50547. }
  50548. public function matches(ConstraintInterface $provider)
  50549. {
  50550. if (false === $this->conjunctive) {
  50551. foreach ($this->constraints as $constraint) {
  50552. if ($constraint->matches($provider)) {
  50553. return true;
  50554. }
  50555. }
  50556. return false;
  50557. }
  50558. foreach ($this->constraints as $constraint) {
  50559. if (!$constraint->matches($provider)) {
  50560. return false;
  50561. }
  50562. }
  50563. return true;
  50564. }
  50565. public function setPrettyString($prettyString)
  50566. {
  50567. $this->prettyString = $prettyString;
  50568. }
  50569. public function getPrettyString()
  50570. {
  50571. if ($this->prettyString) {
  50572. return $this->prettyString;
  50573. }
  50574. return $this->__toString();
  50575. }
  50576. public function __toString()
  50577. {
  50578. $constraints = array();
  50579. foreach ($this->constraints as $constraint) {
  50580. $constraints[] = (string) $constraint;
  50581. }
  50582. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50583. }
  50584. }
  50585. <?php
  50586. namespace Composer\Semver;
  50587. use Composer\Semver\Constraint\Constraint;
  50588. class Semver
  50589. {
  50590. const SORT_ASC = 1;
  50591. const SORT_DESC = -1;
  50592. private static $versionParser;
  50593. public static function satisfies($version, $constraints)
  50594. {
  50595. if (null === self::$versionParser) {
  50596. self::$versionParser = new VersionParser();
  50597. }
  50598. $versionParser = self::$versionParser;
  50599. $provider = new Constraint('==', $versionParser->normalize($version));
  50600. $constraints = $versionParser->parseConstraints($constraints);
  50601. return $constraints->matches($provider);
  50602. }
  50603. public static function satisfiedBy(array $versions, $constraints)
  50604. {
  50605. $versions = array_filter($versions, function ($version) use ($constraints) {
  50606. return Semver::satisfies($version, $constraints);
  50607. });
  50608. return array_values($versions);
  50609. }
  50610. public static function sort(array $versions)
  50611. {
  50612. return self::usort($versions, self::SORT_ASC);
  50613. }
  50614. public static function rsort(array $versions)
  50615. {
  50616. return self::usort($versions, self::SORT_DESC);
  50617. }
  50618. private static function usort(array $versions, $direction)
  50619. {
  50620. if (null === self::$versionParser) {
  50621. self::$versionParser = new VersionParser();
  50622. }
  50623. $versionParser = self::$versionParser;
  50624. $normalized = array();
  50625. foreach ($versions as $key => $version) {
  50626. $normalized[] = array($versionParser->normalize($version), $key);
  50627. }
  50628. usort($normalized, function (array $left, array $right) use ($direction) {
  50629. if ($left[0] === $right[0]) {
  50630. return 0;
  50631. }
  50632. if (Comparator::lessThan($left[0], $right[0])) {
  50633. return -$direction;
  50634. }
  50635. return $direction;
  50636. });
  50637. $sorted = array();
  50638. foreach ($normalized as $item) {
  50639. $sorted[] = $versions[$item[1]];
  50640. }
  50641. return $sorted;
  50642. }
  50643. }
  50644. <?php
  50645. namespace Composer\Semver;
  50646. use Composer\Semver\Constraint\ConstraintInterface;
  50647. use Composer\Semver\Constraint\EmptyConstraint;
  50648. use Composer\Semver\Constraint\MultiConstraint;
  50649. use Composer\Semver\Constraint\Constraint;
  50650. class VersionParser
  50651. {
  50652. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50653. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  50654. public static function parseStability($version)
  50655. {
  50656. $version = preg_replace('{#.+$}i', '', $version);
  50657. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  50658. return 'dev';
  50659. }
  50660. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50661. if (!empty($match[3])) {
  50662. return 'dev';
  50663. }
  50664. if (!empty($match[1])) {
  50665. if ('beta' === $match[1] || 'b' === $match[1]) {
  50666. return 'beta';
  50667. }
  50668. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50669. return 'alpha';
  50670. }
  50671. if ('rc' === $match[1]) {
  50672. return 'RC';
  50673. }
  50674. }
  50675. return 'stable';
  50676. }
  50677. public static function normalizeStability($stability)
  50678. {
  50679. $stability = strtolower($stability);
  50680. return $stability === 'rc' ? 'RC' : $stability;
  50681. }
  50682. public function normalize($version, $fullVersion = null)
  50683. {
  50684. $version = trim($version);
  50685. if (null === $fullVersion) {
  50686. $fullVersion = $version;
  50687. }
  50688. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50689. $version = $match[1];
  50690. }
  50691. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  50692. return '9999999-dev';
  50693. }
  50694. if ('dev-' === strtolower(substr($version, 0, 4))) {
  50695. return 'dev-' . substr($version, 4);
  50696. }
  50697. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50698. $version = $match[1];
  50699. }
  50700. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50701. $version = $matches[1]
  50702. . (!empty($matches[2]) ? $matches[2] : '.0')
  50703. . (!empty($matches[3]) ? $matches[3] : '.0')
  50704. . (!empty($matches[4]) ? $matches[4] : '.0');
  50705. $index = 5;
  50706. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  50707. $version = preg_replace('{\D}', '.', $matches[1]);
  50708. $index = 2;
  50709. }
  50710. if (isset($index)) {
  50711. if (!empty($matches[$index])) {
  50712. if ('stable' === $matches[$index]) {
  50713. return $version;
  50714. }
  50715. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  50716. }
  50717. if (!empty($matches[$index + 2])) {
  50718. $version .= '-dev';
  50719. }
  50720. return $version;
  50721. }
  50722. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50723. try {
  50724. return $this->normalizeBranch($match[1]);
  50725. } catch (\Exception $e) {
  50726. }
  50727. }
  50728. $extraMessage = '';
  50729. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  50730. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50731. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  50732. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50733. }
  50734. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  50735. }
  50736. public function parseNumericAliasPrefix($branch)
  50737. {
  50738. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  50739. return $matches['version'] . '.';
  50740. }
  50741. return false;
  50742. }
  50743. public function normalizeBranch($name)
  50744. {
  50745. $name = trim($name);
  50746. if (in_array($name, array('master', 'trunk', 'default'))) {
  50747. return $this->normalize($name);
  50748. }
  50749. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50750. $version = '';
  50751. for ($i = 1; $i < 5; ++$i) {
  50752. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50753. }
  50754. return str_replace('x', '9999999', $version) . '-dev';
  50755. }
  50756. return 'dev-' . $name;
  50757. }
  50758. public function parseConstraints($constraints)
  50759. {
  50760. $prettyConstraint = $constraints;
  50761. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  50762. $constraints = empty($match[1]) ? '*' : $match[1];
  50763. }
  50764. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  50765. $constraints = $match[1];
  50766. }
  50767. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  50768. $orGroups = array();
  50769. foreach ($orConstraints as $constraints) {
  50770. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  50771. if (count($andConstraints) > 1) {
  50772. $constraintObjects = array();
  50773. foreach ($andConstraints as $constraint) {
  50774. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  50775. $constraintObjects[] = $parsedConstraint;
  50776. }
  50777. }
  50778. } else {
  50779. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50780. }
  50781. if (1 === count($constraintObjects)) {
  50782. $constraint = $constraintObjects[0];
  50783. } else {
  50784. $constraint = new MultiConstraint($constraintObjects);
  50785. }
  50786. $orGroups[] = $constraint;
  50787. }
  50788. if (1 === count($orGroups)) {
  50789. $constraint = $orGroups[0];
  50790. } elseif (2 === count($orGroups)
  50791. && $orGroups[0] instanceof MultiConstraint
  50792. && $orGroups[1] instanceof MultiConstraint
  50793. && 2 === count($orGroups[0]->getConstraints())
  50794. && 2 === count($orGroups[1]->getConstraints())
  50795. && ($a = (string) $orGroups[0])
  50796. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  50797. && ($b = (string) $orGroups[1])
  50798. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  50799. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  50800. ) {
  50801. $constraint = new MultiConstraint(array(
  50802. new Constraint('>=', substr($a, 4, $posA - 5)),
  50803. new Constraint('<', substr($b, $posB + 2, -1)),
  50804. ));
  50805. } else {
  50806. $constraint = new MultiConstraint($orGroups, false);
  50807. }
  50808. $constraint->setPrettyString($prettyConstraint);
  50809. return $constraint;
  50810. }
  50811. private function parseConstraint($constraint)
  50812. {
  50813. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  50814. $constraint = $match[1];
  50815. if ($match[2] !== 'stable') {
  50816. $stabilityModifier = $match[2];
  50817. }
  50818. }
  50819. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  50820. return array(new EmptyConstraint());
  50821. }
  50822. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  50823. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50824. if (substr($constraint, 0, 2) === '~>') {
  50825. throw new \UnexpectedValueException(
  50826. 'Could not parse version constraint ' . $constraint . ': ' .
  50827. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50828. );
  50829. }
  50830. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  50831. $position = 4;
  50832. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50833. $position = 3;
  50834. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50835. $position = 2;
  50836. } else {
  50837. $position = 1;
  50838. }
  50839. $stabilitySuffix = '';
  50840. if (empty($matches[5]) && empty($matches[7])) {
  50841. $stabilitySuffix .= '-dev';
  50842. }
  50843. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50844. $lowerBound = new Constraint('>=', $lowVersion);
  50845. $highPosition = max(1, $position - 1);
  50846. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50847. $upperBound = new Constraint('<', $highVersion);
  50848. return array(
  50849. $lowerBound,
  50850. $upperBound,
  50851. );
  50852. }
  50853. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50854. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  50855. $position = 1;
  50856. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  50857. $position = 2;
  50858. } else {
  50859. $position = 3;
  50860. }
  50861. $stabilitySuffix = '';
  50862. if (empty($matches[5]) && empty($matches[7])) {
  50863. $stabilitySuffix .= '-dev';
  50864. }
  50865. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50866. $lowerBound = new Constraint('>=', $lowVersion);
  50867. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50868. $upperBound = new Constraint('<', $highVersion);
  50869. return array(
  50870. $lowerBound,
  50871. $upperBound,
  50872. );
  50873. }
  50874. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50875. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50876. $position = 3;
  50877. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50878. $position = 2;
  50879. } else {
  50880. $position = 1;
  50881. }
  50882. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50883. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50884. if ($lowVersion === '0.0.0.0-dev') {
  50885. return array(new Constraint('<', $highVersion));
  50886. }
  50887. return array(
  50888. new Constraint('>=', $lowVersion),
  50889. new Constraint('<', $highVersion),
  50890. );
  50891. }
  50892. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50893. $lowStabilitySuffix = '';
  50894. if (empty($matches[6]) && empty($matches[8])) {
  50895. $lowStabilitySuffix = '-dev';
  50896. }
  50897. $lowVersion = $this->normalize($matches['from']);
  50898. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50899. $empty = function ($x) {
  50900. return ($x === 0 || $x === '0') ? false : empty($x);
  50901. };
  50902. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  50903. $highVersion = $this->normalize($matches['to']);
  50904. $upperBound = new Constraint('<=', $highVersion);
  50905. } else {
  50906. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  50907. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  50908. $upperBound = new Constraint('<', $highVersion);
  50909. }
  50910. return array(
  50911. $lowerBound,
  50912. $upperBound,
  50913. );
  50914. }
  50915. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50916. try {
  50917. $version = $this->normalize($matches[2]);
  50918. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  50919. $version .= '-' . $stabilityModifier;
  50920. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  50921. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50922. if (substr($matches[2], 0, 4) !== 'dev-') {
  50923. $version .= '-dev';
  50924. }
  50925. }
  50926. }
  50927. return array(new Constraint($matches[1] ?: '=', $version));
  50928. } catch (\Exception $e) {
  50929. }
  50930. }
  50931. $message = 'Could not parse version constraint ' . $constraint;
  50932. if (isset($e)) {
  50933. $message .= ': ' . $e->getMessage();
  50934. }
  50935. throw new \UnexpectedValueException($message);
  50936. }
  50937. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  50938. {
  50939. for ($i = 4; $i > 0; --$i) {
  50940. if ($i > $position) {
  50941. $matches[$i] = $pad;
  50942. } elseif ($i === $position && $increment) {
  50943. $matches[$i] += $increment;
  50944. if ($matches[$i] < 0) {
  50945. $matches[$i] = $pad;
  50946. --$position;
  50947. if ($i === 1) {
  50948. return;
  50949. }
  50950. }
  50951. }
  50952. }
  50953. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50954. }
  50955. private function expandStability($stability)
  50956. {
  50957. $stability = strtolower($stability);
  50958. switch ($stability) {
  50959. case 'a':
  50960. return 'alpha';
  50961. case 'b':
  50962. return 'beta';
  50963. case 'p':
  50964. case 'pl':
  50965. return 'patch';
  50966. case 'rc':
  50967. return 'RC';
  50968. default:
  50969. return $stability;
  50970. }
  50971. }
  50972. }
  50973. Copyright (C) 2016 Composer
  50974. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50975. this software and associated documentation files (the "Software"), to deal in
  50976. the Software without restriction, including without limitation the rights to
  50977. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50978. of the Software, and to permit persons to whom the Software is furnished to do
  50979. so, subject to the following conditions:
  50980. The above copyright notice and this permission notice shall be included in all
  50981. copies or substantial portions of the Software.
  50982. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50983. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50984. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50985. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50986. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50987. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50988. SOFTWARE.
  50989. <?php
  50990. namespace Composer\CaBundle;
  50991. use Psr\Log\LoggerInterface;
  50992. use Symfony\Component\Process\PhpProcess;
  50993. class CaBundle
  50994. {
  50995. private static $caPath;
  50996. private static $caFileValidity = array();
  50997. private static $useOpensslParse;
  50998. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  50999. {
  51000. if (self::$caPath !== null) {
  51001. return self::$caPath;
  51002. }
  51003. $caBundlePaths = array();
  51004. $caBundlePaths[] = getenv('SSL_CERT_FILE');
  51005. $caBundlePaths[] = getenv('SSL_CERT_DIR');
  51006. $caBundlePaths[] = ini_get('openssl.cafile');
  51007. $caBundlePaths[] = ini_get('openssl.capath');
  51008. $otherLocations = array(
  51009. '/etc/pki/tls/certs/ca-bundle.crt',
  51010. '/etc/ssl/certs/ca-certificates.crt',
  51011. '/etc/ssl/ca-bundle.pem',
  51012. '/usr/local/share/certs/ca-root-nss.crt',
  51013. '/usr/ssl/certs/ca-bundle.crt',
  51014. '/opt/local/share/curl/curl-ca-bundle.crt',
  51015. '/usr/local/share/curl/curl-ca-bundle.crt',
  51016. '/usr/share/ssl/certs/ca-bundle.crt',
  51017. '/etc/ssl/cert.pem',
  51018. '/usr/local/etc/ssl/cert.pem',
  51019. '/usr/local/etc/openssl/cert.pem',
  51020. );
  51021. foreach($otherLocations as $location) {
  51022. $otherLocations[] = dirname($location);
  51023. }
  51024. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  51025. foreach ($caBundlePaths as $caBundle) {
  51026. if (self::caFileUsable($caBundle, $logger)) {
  51027. return self::$caPath = $caBundle;
  51028. }
  51029. if (self::caDirUsable($caBundle)) {
  51030. return self::$caPath = $caBundle;
  51031. }
  51032. }
  51033. return self::$caPath = static::getBundledCaBundlePath();
  51034. }
  51035. public static function getBundledCaBundlePath()
  51036. {
  51037. $caBundleFile = __DIR__.'/../res/cacert.pem';
  51038. if (0 === strpos($caBundleFile, 'phar://')) {
  51039. file_put_contents(
  51040. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  51041. file_get_contents($caBundleFile)
  51042. );
  51043. register_shutdown_function(function() use ($tempCaBundleFile) {
  51044. @unlink($tempCaBundleFile);
  51045. });
  51046. $caBundleFile = $tempCaBundleFile;
  51047. }
  51048. return $caBundleFile;
  51049. }
  51050. public static function validateCaFile($filename, LoggerInterface $logger = null)
  51051. {
  51052. static $warned = false;
  51053. if (isset(self::$caFileValidity[$filename])) {
  51054. return self::$caFileValidity[$filename];
  51055. }
  51056. $contents = file_get_contents($filename);
  51057. if (!static::isOpensslParseSafe()) {
  51058. if (!$warned && $logger) {
  51059. $logger->warning(sprintf(
  51060. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  51061. PHP_VERSION
  51062. ));
  51063. $warned = true;
  51064. }
  51065. $isValid = !empty($contents);
  51066. } else {
  51067. $isValid = (bool) openssl_x509_parse($contents);
  51068. }
  51069. if ($logger) {
  51070. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  51071. }
  51072. return self::$caFileValidity[$filename] = $isValid;
  51073. }
  51074. public static function isOpensslParseSafe()
  51075. {
  51076. if (null !== self::$useOpensslParse) {
  51077. return self::$useOpensslParse;
  51078. }
  51079. if (PHP_VERSION_ID >= 50600) {
  51080. return self::$useOpensslParse = true;
  51081. }
  51082. if (
  51083. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  51084. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  51085. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  51086. ) {
  51087. return self::$useOpensslParse = true;
  51088. }
  51089. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51090. return self::$useOpensslParse = false;
  51091. }
  51092. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  51093. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  51094. if (preg_match($regex, PHP_VERSION, $m)) {
  51095. return ((int) $m[1]) >= $fixedVersion;
  51096. }
  51097. return false;
  51098. };
  51099. if (
  51100. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  51101. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  51102. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  51103. ) {
  51104. return self::$useOpensslParse = true;
  51105. }
  51106. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  51107. return self::$useOpensslParse = false;
  51108. }
  51109. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  51110. $script = <<<'EOT'
  51111. error_reporting(-1);
  51112. $info = openssl_x509_parse(base64_decode('%s'));
  51113. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  51114. EOT;
  51115. $script = '<'."?php\n".sprintf($script, $cert);
  51116. try {
  51117. $process = new PhpProcess($script);
  51118. $process->mustRun();
  51119. } catch (\Exception $e) {
  51120. return self::$useOpensslParse = false;
  51121. }
  51122. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  51123. $errorOutput = trim($process->getErrorOutput());
  51124. if (
  51125. count($output) === 3
  51126. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  51127. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  51128. && $output[2] === 'int(-1)'
  51129. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  51130. ) {
  51131. return self::$useOpensslParse = true;
  51132. }
  51133. return self::$useOpensslParse = false;
  51134. }
  51135. public static function reset()
  51136. {
  51137. self::$caFileValidity = array();
  51138. self::$caPath = null;
  51139. self::$useOpensslParse = null;
  51140. }
  51141. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  51142. {
  51143. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  51144. }
  51145. private static function caDirUsable($certDir)
  51146. {
  51147. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  51148. }
  51149. }
  51150. MIT License
  51151. Copyright (c) 2017 Composer
  51152. Permission is hereby granted, free of charge, to any person obtaining a copy
  51153. of this software and associated documentation files (the "Software"), to deal
  51154. in the Software without restriction, including without limitation the rights
  51155. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51156. copies of the Software, and to permit persons to whom the Software is
  51157. furnished to do so, subject to the following conditions:
  51158. The above copyright notice and this permission notice shall be included in all
  51159. copies or substantial portions of the Software.
  51160. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51161. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51162. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51163. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51164. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51165. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51166. SOFTWARE.
  51167. <?php
  51168. namespace Composer\XdebugHandler;
  51169. class PhpConfig
  51170. {
  51171. public function useOriginal()
  51172. {
  51173. $this->getDataAndReset();
  51174. return array();
  51175. }
  51176. public function useStandard()
  51177. {
  51178. if ($data = $this->getDataAndReset()) {
  51179. return array('-n', '-c', $data['tmpIni']);
  51180. }
  51181. return array();
  51182. }
  51183. public function usePersistent()
  51184. {
  51185. if ($data = $this->getDataAndReset()) {
  51186. Process::setEnv('PHPRC', $data['tmpIni']);
  51187. Process::setEnv('PHP_INI_SCAN_DIR', '');
  51188. }
  51189. return array();
  51190. }
  51191. private function getDataAndReset()
  51192. {
  51193. if ($data = XdebugHandler::getRestartSettings()) {
  51194. Process::setEnv('PHPRC', $data['phprc']);
  51195. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  51196. }
  51197. return $data;
  51198. }
  51199. }
  51200. <?php
  51201. namespace Composer\XdebugHandler;
  51202. class Process
  51203. {
  51204. public static function addColorOption(array $args, $colorOption)
  51205. {
  51206. if (!$colorOption
  51207. || in_array($colorOption, $args)
  51208. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  51209. return $args;
  51210. }
  51211. if (isset($matches[2])) {
  51212. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  51213. $args[$index] = $colorOption;
  51214. return $args;
  51215. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  51216. return $args;
  51217. }
  51218. } elseif (in_array('--no-'.$matches[1], $args)) {
  51219. return $args;
  51220. }
  51221. if (false !== ($index = array_search('--', $args))) {
  51222. array_splice($args, $index, 0, $colorOption);
  51223. } else {
  51224. $args[] = $colorOption;
  51225. }
  51226. return $args;
  51227. }
  51228. public static function escape($arg, $meta = true, $module = false)
  51229. {
  51230. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  51231. return "'".str_replace("'", "'\\''", $arg)."'";
  51232. }
  51233. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  51234. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  51235. if ($meta) {
  51236. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  51237. if (!$meta) {
  51238. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  51239. } elseif ($module && !$dquotes && $quote) {
  51240. $meta = false;
  51241. }
  51242. }
  51243. if ($quote) {
  51244. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  51245. }
  51246. if ($meta) {
  51247. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  51248. }
  51249. return $arg;
  51250. }
  51251. public static function supportsColor($output)
  51252. {
  51253. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51254. return (function_exists('sapi_windows_vt100_support')
  51255. && sapi_windows_vt100_support($output))
  51256. || false !== getenv('ANSICON')
  51257. || 'ON' === getenv('ConEmuANSI')
  51258. || 'xterm' === getenv('TERM');
  51259. }
  51260. if (function_exists('stream_isatty')) {
  51261. return stream_isatty($output);
  51262. } elseif (function_exists('posix_isatty')) {
  51263. return posix_isatty($output);
  51264. }
  51265. $stat = fstat($output);
  51266. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  51267. }
  51268. public static function setEnv($name, $value = false)
  51269. {
  51270. $unset = false === $value;
  51271. if (!putenv($unset ? $name : $name.'='.$value)) {
  51272. return false;
  51273. }
  51274. if ($unset) {
  51275. unset($_SERVER[$name]);
  51276. } else {
  51277. $_SERVER[$name] = $value;
  51278. }
  51279. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  51280. if ($unset) {
  51281. unset($_ENV[$name]);
  51282. } else {
  51283. $_ENV[$name] = $value;
  51284. }
  51285. }
  51286. return true;
  51287. }
  51288. }
  51289. <?php
  51290. namespace Composer\XdebugHandler;
  51291. use Psr\Log\LoggerInterface;
  51292. use Psr\Log\LogLevel;
  51293. class Status
  51294. {
  51295. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  51296. const CHECK = 'Check';
  51297. const ERROR = 'Error';
  51298. const INFO = 'Info';
  51299. const NORESTART = 'NoRestart';
  51300. const RESTART = 'Restart';
  51301. const RESTARTING = 'Restarting';
  51302. const RESTARTED = 'Restarted';
  51303. private $debug;
  51304. private $envAllowXdebug;
  51305. private $loaded;
  51306. private $logger;
  51307. private $time;
  51308. public function __construct($envAllowXdebug, $debug)
  51309. {
  51310. $start = getenv(self::ENV_RESTART);
  51311. Process::setEnv(self::ENV_RESTART);
  51312. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  51313. $this->envAllowXdebug = $envAllowXdebug;
  51314. $this->debug = $debug && defined('STDERR');
  51315. }
  51316. public function setLogger(LoggerInterface $logger)
  51317. {
  51318. $this->logger = $logger;
  51319. }
  51320. public function report($op, $data)
  51321. {
  51322. if ($this->logger || $this->debug) {
  51323. call_user_func(array($this, 'report'.$op), $data);
  51324. }
  51325. }
  51326. private function output($text, $level = null)
  51327. {
  51328. if ($this->logger) {
  51329. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  51330. }
  51331. if ($this->debug) {
  51332. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  51333. }
  51334. }
  51335. private function reportCheck($loaded)
  51336. {
  51337. $this->loaded = $loaded;
  51338. $this->output('Checking '.$this->envAllowXdebug);
  51339. }
  51340. private function reportError($error)
  51341. {
  51342. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  51343. }
  51344. private function reportInfo($info)
  51345. {
  51346. $this->output($info);
  51347. }
  51348. private function reportNoRestart()
  51349. {
  51350. $this->output($this->getLoadedMessage());
  51351. if ($this->loaded) {
  51352. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  51353. if (!getenv($this->envAllowXdebug)) {
  51354. $text .= ' Allowed by application';
  51355. }
  51356. $this->output($text);
  51357. }
  51358. }
  51359. private function reportRestart()
  51360. {
  51361. $this->output($this->getLoadedMessage());
  51362. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  51363. }
  51364. private function reportRestarted()
  51365. {
  51366. $loaded = $this->getLoadedMessage();
  51367. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  51368. $level = $this->loaded ? LogLevel::WARNING : null;
  51369. $this->output($text, $level);
  51370. }
  51371. private function reportRestarting($command)
  51372. {
  51373. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  51374. $this->output($text);
  51375. $text = 'Running '.$command;
  51376. $this->output($text);
  51377. }
  51378. private function getEnvAllow()
  51379. {
  51380. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  51381. }
  51382. private function getLoadedMessage()
  51383. {
  51384. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  51385. return 'The xdebug extension is '.$loaded;
  51386. }
  51387. }
  51388. <?php
  51389. namespace Composer\XdebugHandler;
  51390. use Psr\Log\LoggerInterface;
  51391. class XdebugHandler
  51392. {
  51393. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  51394. const SUFFIX_INIS = '_ORIGINAL_INIS';
  51395. const RESTART_ID = 'internal';
  51396. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  51397. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  51398. protected $tmpIni;
  51399. private static $inRestart;
  51400. private static $name;
  51401. private static $skipped;
  51402. private $cli;
  51403. private $colorOption;
  51404. private $debug;
  51405. private $envAllowXdebug;
  51406. private $envOriginalInis;
  51407. private $loaded;
  51408. private $persistent;
  51409. private $script;
  51410. private $statusWriter;
  51411. public function __construct($envPrefix, $colorOption = '')
  51412. {
  51413. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  51414. throw new \RuntimeException('Invalid constructor parameter');
  51415. }
  51416. self::$name = strtoupper($envPrefix);
  51417. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  51418. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  51419. $this->colorOption = $colorOption;
  51420. if (extension_loaded('xdebug')) {
  51421. $ext = new \ReflectionExtension('xdebug');
  51422. $this->loaded = $ext->getVersion() ?: 'unknown';
  51423. }
  51424. if ($this->cli = PHP_SAPI === 'cli') {
  51425. $this->debug = getenv(self::DEBUG);
  51426. }
  51427. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  51428. }
  51429. public function setLogger(LoggerInterface $logger)
  51430. {
  51431. $this->statusWriter->setLogger($logger);
  51432. return $this;
  51433. }
  51434. public function setMainScript($script)
  51435. {
  51436. $this->script = $script;
  51437. return $this;
  51438. }
  51439. public function setPersistent()
  51440. {
  51441. $this->persistent = true;
  51442. return $this;
  51443. }
  51444. public function check()
  51445. {
  51446. $this->notify(Status::CHECK, $this->loaded);
  51447. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  51448. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  51449. $this->notify(Status::RESTART);
  51450. if ($this->prepareRestart()) {
  51451. $command = $this->getCommand();
  51452. $this->notify(Status::RESTARTING, $command);
  51453. $this->restart($command);
  51454. }
  51455. return;
  51456. }
  51457. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  51458. $this->notify(Status::RESTARTED);
  51459. Process::setEnv($this->envAllowXdebug);
  51460. self::$inRestart = true;
  51461. if (!$this->loaded) {
  51462. self::$skipped = $envArgs[1];
  51463. }
  51464. $this->setEnvRestartSettings($envArgs);
  51465. return;
  51466. }
  51467. $this->notify(Status::NORESTART);
  51468. if ($settings = self::getRestartSettings()) {
  51469. $this->syncSettings($settings);
  51470. }
  51471. }
  51472. public static function getAllIniFiles()
  51473. {
  51474. if (!empty(self::$name)) {
  51475. $env = getenv(self::$name.self::SUFFIX_INIS);
  51476. if (false !== $env) {
  51477. return explode(PATH_SEPARATOR, $env);
  51478. }
  51479. }
  51480. $paths = array((string) php_ini_loaded_file());
  51481. if ($scanned = php_ini_scanned_files()) {
  51482. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  51483. }
  51484. return $paths;
  51485. }
  51486. public static function getRestartSettings()
  51487. {
  51488. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  51489. if (count($envArgs) !== 6
  51490. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  51491. return;
  51492. }
  51493. return array(
  51494. 'tmpIni' => $envArgs[0],
  51495. 'scannedInis' => (bool) $envArgs[1],
  51496. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  51497. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  51498. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  51499. 'skipped' => $envArgs[5],
  51500. );
  51501. }
  51502. public static function getSkippedVersion()
  51503. {
  51504. return (string) self::$skipped;
  51505. }
  51506. protected function requiresRestart($isLoaded)
  51507. {
  51508. return $isLoaded;
  51509. }
  51510. protected function restart($command)
  51511. {
  51512. $this->doRestart($command);
  51513. }
  51514. private function doRestart($command)
  51515. {
  51516. passthru($command, $exitCode);
  51517. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  51518. if ($this->debug === '2') {
  51519. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  51520. } else {
  51521. @unlink($this->tmpIni);
  51522. }
  51523. exit($exitCode);
  51524. }
  51525. private function prepareRestart()
  51526. {
  51527. $error = '';
  51528. $iniFiles = self::getAllIniFiles();
  51529. $scannedInis = count($iniFiles) > 1;
  51530. $tmpDir = sys_get_temp_dir();
  51531. if (!$this->cli) {
  51532. $error = 'Unsupported SAPI: '.PHP_SAPI;
  51533. } elseif (!defined('PHP_BINARY')) {
  51534. $error = 'PHP version is too old: '.PHP_VERSION;
  51535. } elseif (!$this->checkConfiguration($info)) {
  51536. $error = $info;
  51537. } elseif (!$this->checkScanDirConfig()) {
  51538. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  51539. } elseif (!$this->checkMainScript()) {
  51540. $error = 'Unable to access main script: '.$this->script;
  51541. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  51542. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  51543. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  51544. $error = 'Unable to set environment variables';
  51545. }
  51546. if ($error) {
  51547. $this->notify(Status::ERROR, $error);
  51548. }
  51549. return empty($error);
  51550. }
  51551. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  51552. {
  51553. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  51554. return false;
  51555. }
  51556. if (empty($iniFiles[0])) {
  51557. array_shift($iniFiles);
  51558. }
  51559. $content = '';
  51560. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  51561. foreach ($iniFiles as $file) {
  51562. if (!$data = @file_get_contents($file)) {
  51563. $error = 'Unable to read ini: '.$file;
  51564. return false;
  51565. }
  51566. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  51567. }
  51568. if ($config = parse_ini_string($content)) {
  51569. $loaded = ini_get_all(null, false);
  51570. $content .= $this->mergeLoadedConfig($loaded, $config);
  51571. }
  51572. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  51573. return @file_put_contents($this->tmpIni, $content);
  51574. }
  51575. private function getCommand()
  51576. {
  51577. $php = array(PHP_BINARY);
  51578. $args = array_slice($_SERVER['argv'], 1);
  51579. if (!$this->persistent) {
  51580. array_push($php, '-n', '-c', $this->tmpIni);
  51581. }
  51582. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  51583. $args = Process::addColorOption($args, $this->colorOption);
  51584. }
  51585. $args = array_merge($php, array($this->script), $args);
  51586. $cmd = Process::escape(array_shift($args), true, true);
  51587. foreach ($args as $arg) {
  51588. $cmd .= ' '.Process::escape($arg);
  51589. }
  51590. return $cmd;
  51591. }
  51592. private function setEnvironment($scannedInis, array $iniFiles)
  51593. {
  51594. $scanDir = getenv('PHP_INI_SCAN_DIR');
  51595. $phprc = getenv('PHPRC');
  51596. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  51597. return false;
  51598. }
  51599. if ($this->persistent) {
  51600. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  51601. return false;
  51602. }
  51603. }
  51604. $envArgs = array(
  51605. self::RESTART_ID,
  51606. $this->loaded,
  51607. (int) $scannedInis,
  51608. false === $scanDir ? '*' : $scanDir,
  51609. false === $phprc ? '*' : $phprc,
  51610. );
  51611. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  51612. }
  51613. private function notify($op, $data = null)
  51614. {
  51615. $this->statusWriter->report($op, $data);
  51616. }
  51617. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  51618. {
  51619. $content = '';
  51620. foreach ($loadedConfig as $name => $value) {
  51621. if (!is_string($value)
  51622. || strpos($name, 'xdebug') === 0
  51623. || $name === 'apc.mmap_file_mask') {
  51624. continue;
  51625. }
  51626. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  51627. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  51628. }
  51629. }
  51630. return $content;
  51631. }
  51632. private function checkMainScript()
  51633. {
  51634. if (null !== $this->script) {
  51635. return file_exists($this->script) || '--' === $this->script;
  51636. }
  51637. if (file_exists($this->script = $_SERVER['argv'][0])) {
  51638. return true;
  51639. }
  51640. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  51641. $trace = debug_backtrace($options);
  51642. if (($main = end($trace)) && isset($main['file'])) {
  51643. return file_exists($this->script = $main['file']);
  51644. }
  51645. return false;
  51646. }
  51647. private function setEnvRestartSettings($envArgs)
  51648. {
  51649. $settings = array(
  51650. php_ini_loaded_file(),
  51651. $envArgs[2],
  51652. $envArgs[3],
  51653. $envArgs[4],
  51654. getenv($this->envOriginalInis),
  51655. self::$skipped,
  51656. );
  51657. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  51658. }
  51659. private function syncSettings(array $settings)
  51660. {
  51661. if (false === getenv($this->envOriginalInis)) {
  51662. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  51663. }
  51664. self::$skipped = $settings['skipped'];
  51665. $this->notify(Status::INFO, 'Process called with existing restart settings');
  51666. }
  51667. private function checkScanDirConfig()
  51668. {
  51669. return !(getenv('PHP_INI_SCAN_DIR')
  51670. && !PHP_CONFIG_FILE_SCAN_DIR
  51671. && (PHP_VERSION_ID < 70113
  51672. || PHP_VERSION_ID === 70200));
  51673. }
  51674. private function checkConfiguration(&$info)
  51675. {
  51676. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  51677. $info = 'passthru function is disabled';
  51678. return false;
  51679. }
  51680. if (extension_loaded('uopz')) {
  51681. if (function_exists('uopz_allow_exit')) {
  51682. @uopz_allow_exit(true);
  51683. } else {
  51684. $info = 'uopz extension is not compatible';
  51685. return false;
  51686. }
  51687. }
  51688. return true;
  51689. }
  51690. }
  51691. Copyright (c) 2012 PHP Framework Interoperability Group
  51692. Permission is hereby granted, free of charge, to any person obtaining a copy
  51693. of this software and associated documentation files (the "Software"), to deal
  51694. in the Software without restriction, including without limitation the rights
  51695. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51696. copies of the Software, and to permit persons to whom the Software is
  51697. furnished to do so, subject to the following conditions:
  51698. The above copyright notice and this permission notice shall be included in
  51699. all copies or substantial portions of the Software.
  51700. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51701. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51702. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51703. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51704. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51705. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51706. THE SOFTWARE.
  51707. <?php
  51708. namespace Psr\Log;
  51709. abstract class AbstractLogger implements LoggerInterface
  51710. {
  51711. public function emergency($message, array $context = array())
  51712. {
  51713. $this->log(LogLevel::EMERGENCY, $message, $context);
  51714. }
  51715. public function alert($message, array $context = array())
  51716. {
  51717. $this->log(LogLevel::ALERT, $message, $context);
  51718. }
  51719. public function critical($message, array $context = array())
  51720. {
  51721. $this->log(LogLevel::CRITICAL, $message, $context);
  51722. }
  51723. public function error($message, array $context = array())
  51724. {
  51725. $this->log(LogLevel::ERROR, $message, $context);
  51726. }
  51727. public function warning($message, array $context = array())
  51728. {
  51729. $this->log(LogLevel::WARNING, $message, $context);
  51730. }
  51731. public function notice($message, array $context = array())
  51732. {
  51733. $this->log(LogLevel::NOTICE, $message, $context);
  51734. }
  51735. public function info($message, array $context = array())
  51736. {
  51737. $this->log(LogLevel::INFO, $message, $context);
  51738. }
  51739. public function debug($message, array $context = array())
  51740. {
  51741. $this->log(LogLevel::DEBUG, $message, $context);
  51742. }
  51743. }
  51744. <?php
  51745. namespace Psr\Log;
  51746. class InvalidArgumentException extends \InvalidArgumentException
  51747. {
  51748. }
  51749. <?php
  51750. namespace Psr\Log;
  51751. class LogLevel
  51752. {
  51753. const EMERGENCY = 'emergency';
  51754. const ALERT = 'alert';
  51755. const CRITICAL = 'critical';
  51756. const ERROR = 'error';
  51757. const WARNING = 'warning';
  51758. const NOTICE = 'notice';
  51759. const INFO = 'info';
  51760. const DEBUG = 'debug';
  51761. }
  51762. <?php
  51763. namespace Psr\Log;
  51764. interface LoggerAwareInterface
  51765. {
  51766. public function setLogger(LoggerInterface $logger);
  51767. }
  51768. <?php
  51769. namespace Psr\Log;
  51770. trait LoggerAwareTrait
  51771. {
  51772. protected $logger;
  51773. public function setLogger(LoggerInterface $logger)
  51774. {
  51775. $this->logger = $logger;
  51776. }
  51777. }
  51778. <?php
  51779. namespace Psr\Log;
  51780. interface LoggerInterface
  51781. {
  51782. public function emergency($message, array $context = array());
  51783. public function alert($message, array $context = array());
  51784. public function critical($message, array $context = array());
  51785. public function error($message, array $context = array());
  51786. public function warning($message, array $context = array());
  51787. public function notice($message, array $context = array());
  51788. public function info($message, array $context = array());
  51789. public function debug($message, array $context = array());
  51790. public function log($level, $message, array $context = array());
  51791. }
  51792. <?php
  51793. namespace Psr\Log;
  51794. trait LoggerTrait
  51795. {
  51796. public function emergency($message, array $context = array())
  51797. {
  51798. $this->log(LogLevel::EMERGENCY, $message, $context);
  51799. }
  51800. public function alert($message, array $context = array())
  51801. {
  51802. $this->log(LogLevel::ALERT, $message, $context);
  51803. }
  51804. public function critical($message, array $context = array())
  51805. {
  51806. $this->log(LogLevel::CRITICAL, $message, $context);
  51807. }
  51808. public function error($message, array $context = array())
  51809. {
  51810. $this->log(LogLevel::ERROR, $message, $context);
  51811. }
  51812. public function warning($message, array $context = array())
  51813. {
  51814. $this->log(LogLevel::WARNING, $message, $context);
  51815. }
  51816. public function notice($message, array $context = array())
  51817. {
  51818. $this->log(LogLevel::NOTICE, $message, $context);
  51819. }
  51820. public function info($message, array $context = array())
  51821. {
  51822. $this->log(LogLevel::INFO, $message, $context);
  51823. }
  51824. public function debug($message, array $context = array())
  51825. {
  51826. $this->log(LogLevel::DEBUG, $message, $context);
  51827. }
  51828. abstract public function log($level, $message, array $context = array());
  51829. }
  51830. <?php
  51831. namespace Psr\Log;
  51832. class NullLogger extends AbstractLogger
  51833. {
  51834. public function log($level, $message, array $context = array())
  51835. {
  51836. }
  51837. }
  51838. <?php
  51839. namespace Psr\Log\Test;
  51840. use Psr\Log\LoggerInterface;
  51841. use Psr\Log\LogLevel;
  51842. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  51843. {
  51844. abstract public function getLogger();
  51845. abstract public function getLogs();
  51846. public function testImplements()
  51847. {
  51848. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  51849. }
  51850. public function testLogsAtAllLevels($level, $message)
  51851. {
  51852. $logger = $this->getLogger();
  51853. $logger->{$level}($message, array('user' => 'Bob'));
  51854. $logger->log($level, $message, array('user' => 'Bob'));
  51855. $expected = array(
  51856. $level.' message of level '.$level.' with context: Bob',
  51857. $level.' message of level '.$level.' with context: Bob',
  51858. );
  51859. $this->assertEquals($expected, $this->getLogs());
  51860. }
  51861. public function provideLevelsAndMessages()
  51862. {
  51863. return array(
  51864. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  51865. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  51866. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  51867. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  51868. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  51869. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  51870. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  51871. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  51872. );
  51873. }
  51874. public function testThrowsOnInvalidLevel()
  51875. {
  51876. $logger = $this->getLogger();
  51877. $logger->log('invalid level', 'Foo');
  51878. }
  51879. public function testContextReplacement()
  51880. {
  51881. $logger = $this->getLogger();
  51882. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  51883. $expected = array('info {Message {nothing} Bob Bar a}');
  51884. $this->assertEquals($expected, $this->getLogs());
  51885. }
  51886. public function testObjectCastToString()
  51887. {
  51888. if (method_exists($this, 'createPartialMock')) {
  51889. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  51890. } else {
  51891. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  51892. }
  51893. $dummy->expects($this->once())
  51894. ->method('__toString')
  51895. ->will($this->returnValue('DUMMY'));
  51896. $this->getLogger()->warning($dummy);
  51897. $expected = array('warning DUMMY');
  51898. $this->assertEquals($expected, $this->getLogs());
  51899. }
  51900. public function testContextCanContainAnything()
  51901. {
  51902. $closed = fopen('php://memory', 'r');
  51903. fclose($closed);
  51904. $context = array(
  51905. 'bool' => true,
  51906. 'null' => null,
  51907. 'string' => 'Foo',
  51908. 'int' => 0,
  51909. 'float' => 0.5,
  51910. 'nested' => array('with object' => new DummyTest),
  51911. 'object' => new \DateTime,
  51912. 'resource' => fopen('php://memory', 'r'),
  51913. 'closed' => $closed,
  51914. );
  51915. $this->getLogger()->warning('Crazy context data', $context);
  51916. $expected = array('warning Crazy context data');
  51917. $this->assertEquals($expected, $this->getLogs());
  51918. }
  51919. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  51920. {
  51921. $logger = $this->getLogger();
  51922. $logger->warning('Random message', array('exception' => 'oops'));
  51923. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  51924. $expected = array(
  51925. 'warning Random message',
  51926. 'critical Uncaught Exception!'
  51927. );
  51928. $this->assertEquals($expected, $this->getLogs());
  51929. }
  51930. }
  51931. class DummyTest
  51932. {
  51933. public function __toString()
  51934. {
  51935. }
  51936. }
  51937. <?php
  51938. namespace Psr\Log\Test;
  51939. use Psr\Log\AbstractLogger;
  51940. class TestLogger extends AbstractLogger
  51941. {
  51942. public $records = [];
  51943. public $recordsByLevel = [];
  51944. public function log($level, $message, array $context = [])
  51945. {
  51946. $record = [
  51947. 'level' => $level,
  51948. 'message' => $message,
  51949. 'context' => $context,
  51950. ];
  51951. $this->recordsByLevel[$record['level']][] = $record;
  51952. $this->records[] = $record;
  51953. }
  51954. public function hasRecords($level)
  51955. {
  51956. return isset($this->recordsByLevel[$level]);
  51957. }
  51958. public function hasRecord($record, $level)
  51959. {
  51960. if (is_string($record)) {
  51961. $record = ['message' => $record];
  51962. }
  51963. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  51964. if ($rec['message'] !== $record['message']) {
  51965. return false;
  51966. }
  51967. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  51968. return false;
  51969. }
  51970. return true;
  51971. }, $level);
  51972. }
  51973. public function hasRecordThatContains($message, $level)
  51974. {
  51975. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  51976. return strpos($rec['message'], $message) !== false;
  51977. }, $level);
  51978. }
  51979. public function hasRecordThatMatches($regex, $level)
  51980. {
  51981. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  51982. return preg_match($regex, $rec['message']) > 0;
  51983. }, $level);
  51984. }
  51985. public function hasRecordThatPasses(callable $predicate, $level)
  51986. {
  51987. if (!isset($this->recordsByLevel[$level])) {
  51988. return false;
  51989. }
  51990. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  51991. if (call_user_func($predicate, $rec, $i)) {
  51992. return true;
  51993. }
  51994. }
  51995. return false;
  51996. }
  51997. public function __call($method, $args)
  51998. {
  51999. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  52000. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  52001. $level = strtolower($matches[2]);
  52002. if (method_exists($this, $genericMethod)) {
  52003. $args[] = $level;
  52004. return call_user_func_array([$this, $genericMethod], $args);
  52005. }
  52006. }
  52007. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  52008. }
  52009. public function reset()
  52010. {
  52011. $this->records = [];
  52012. }
  52013. }
  52014. <?php
  52015. require_once __DIR__ . '/composer/autoload_real.php';
  52016. return ComposerAutoloaderInitComposerPhar1564772133::getLoader();
  52017. <?php
  52018. $vendorDir = dirname(dirname(__FILE__));
  52019. $baseDir = dirname($vendorDir);
  52020. return array(
  52021. );
  52022. <?php
  52023. $vendorDir = dirname(dirname(__FILE__));
  52024. $baseDir = dirname($vendorDir);
  52025. return array(
  52026. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  52027. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  52028. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  52029. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  52030. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  52031. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  52032. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  52033. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  52034. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  52035. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  52036. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  52037. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  52038. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  52039. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  52040. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  52041. 'Composer\\' => array($baseDir . '/src/Composer'),
  52042. );
  52043. <?php
  52044. $vendorDir = dirname(dirname(__FILE__));
  52045. $baseDir = dirname($vendorDir);
  52046. return array(
  52047. );
  52048. <?php
  52049. $vendorDir = dirname(dirname(__FILE__));
  52050. $baseDir = dirname($vendorDir);
  52051. return array(
  52052. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  52053. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  52054. );
  52055. <?php
  52056. class ComposerAutoloaderInitComposerPhar1564772133
  52057. {
  52058. private static $loader;
  52059. public static function loadClassLoader($class)
  52060. {
  52061. if ('Composer\Autoload\ClassLoader' === $class) {
  52062. require __DIR__ . '/ClassLoader.php';
  52063. }
  52064. }
  52065. public static function getLoader()
  52066. {
  52067. if (null !== self::$loader) {
  52068. return self::$loader;
  52069. }
  52070. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1564772133', 'loadClassLoader'), true, true);
  52071. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  52072. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1564772133', 'loadClassLoader'));
  52073. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  52074. if ($useStaticLoader) {
  52075. require_once __DIR__ . '/autoload_static.php';
  52076. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1564772133::getInitializer($loader));
  52077. } else {
  52078. $map = require __DIR__ . '/autoload_namespaces.php';
  52079. foreach ($map as $namespace => $path) {
  52080. $loader->set($namespace, $path);
  52081. }
  52082. $map = require __DIR__ . '/autoload_psr4.php';
  52083. foreach ($map as $namespace => $path) {
  52084. $loader->setPsr4($namespace, $path);
  52085. }
  52086. $classMap = require __DIR__ . '/autoload_classmap.php';
  52087. if ($classMap) {
  52088. $loader->addClassMap($classMap);
  52089. }
  52090. }
  52091. $loader->register(true);
  52092. if ($useStaticLoader) {
  52093. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1564772133::$files;
  52094. } else {
  52095. $includeFiles = require __DIR__ . '/autoload_files.php';
  52096. }
  52097. foreach ($includeFiles as $fileIdentifier => $file) {
  52098. composerRequireComposerPhar1564772133($fileIdentifier, $file);
  52099. }
  52100. return $loader;
  52101. }
  52102. }
  52103. function composerRequireComposerPhar1564772133($fileIdentifier, $file)
  52104. {
  52105. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  52106. require $file;
  52107. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  52108. }
  52109. }
  52110. <?php
  52111. namespace Composer\Autoload;
  52112. class ComposerStaticInitComposerPhar1564772133
  52113. {
  52114. public static $files = array (
  52115. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  52116. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  52117. );
  52118. public static $prefixLengthsPsr4 = array (
  52119. 'S' =>
  52120. array (
  52121. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  52122. 'Symfony\\Polyfill\\Ctype\\' => 23,
  52123. 'Symfony\\Component\\Process\\' => 26,
  52124. 'Symfony\\Component\\Finder\\' => 25,
  52125. 'Symfony\\Component\\Filesystem\\' => 29,
  52126. 'Symfony\\Component\\Debug\\' => 24,
  52127. 'Symfony\\Component\\Console\\' => 26,
  52128. 'Seld\\PharUtils\\' => 15,
  52129. 'Seld\\JsonLint\\' => 14,
  52130. ),
  52131. 'P' =>
  52132. array (
  52133. 'Psr\\Log\\' => 8,
  52134. ),
  52135. 'J' =>
  52136. array (
  52137. 'JsonSchema\\' => 11,
  52138. ),
  52139. 'C' =>
  52140. array (
  52141. 'Composer\\XdebugHandler\\' => 23,
  52142. 'Composer\\Spdx\\' => 14,
  52143. 'Composer\\Semver\\' => 16,
  52144. 'Composer\\CaBundle\\' => 18,
  52145. 'Composer\\' => 9,
  52146. ),
  52147. );
  52148. public static $prefixDirsPsr4 = array (
  52149. 'Symfony\\Polyfill\\Mbstring\\' =>
  52150. array (
  52151. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  52152. ),
  52153. 'Symfony\\Polyfill\\Ctype\\' =>
  52154. array (
  52155. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  52156. ),
  52157. 'Symfony\\Component\\Process\\' =>
  52158. array (
  52159. 0 => __DIR__ . '/..' . '/symfony/process',
  52160. ),
  52161. 'Symfony\\Component\\Finder\\' =>
  52162. array (
  52163. 0 => __DIR__ . '/..' . '/symfony/finder',
  52164. ),
  52165. 'Symfony\\Component\\Filesystem\\' =>
  52166. array (
  52167. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  52168. ),
  52169. 'Symfony\\Component\\Debug\\' =>
  52170. array (
  52171. 0 => __DIR__ . '/..' . '/symfony/debug',
  52172. ),
  52173. 'Symfony\\Component\\Console\\' =>
  52174. array (
  52175. 0 => __DIR__ . '/..' . '/symfony/console',
  52176. ),
  52177. 'Seld\\PharUtils\\' =>
  52178. array (
  52179. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  52180. ),
  52181. 'Seld\\JsonLint\\' =>
  52182. array (
  52183. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  52184. ),
  52185. 'Psr\\Log\\' =>
  52186. array (
  52187. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  52188. ),
  52189. 'JsonSchema\\' =>
  52190. array (
  52191. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  52192. ),
  52193. 'Composer\\XdebugHandler\\' =>
  52194. array (
  52195. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  52196. ),
  52197. 'Composer\\Spdx\\' =>
  52198. array (
  52199. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  52200. ),
  52201. 'Composer\\Semver\\' =>
  52202. array (
  52203. 0 => __DIR__ . '/..' . '/composer/semver/src',
  52204. ),
  52205. 'Composer\\CaBundle\\' =>
  52206. array (
  52207. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  52208. ),
  52209. 'Composer\\' =>
  52210. array (
  52211. 0 => __DIR__ . '/../..' . '/src/Composer',
  52212. ),
  52213. );
  52214. public static function getInitializer(ClassLoader $loader)
  52215. {
  52216. return \Closure::bind(function () use ($loader) {
  52217. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1564772133::$prefixLengthsPsr4;
  52218. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1564772133::$prefixDirsPsr4;
  52219. }, null, ClassLoader::class);
  52220. }
  52221. }
  52222. <?php
  52223. namespace Composer\Autoload;
  52224. class ClassLoader
  52225. {
  52226. private $prefixLengthsPsr4 = array();
  52227. private $prefixDirsPsr4 = array();
  52228. private $fallbackDirsPsr4 = array();
  52229. private $prefixesPsr0 = array();
  52230. private $fallbackDirsPsr0 = array();
  52231. private $useIncludePath = false;
  52232. private $classMap = array();
  52233. private $classMapAuthoritative = false;
  52234. private $missingClasses = array();
  52235. private $apcuPrefix;
  52236. public function getPrefixes()
  52237. {
  52238. if (!empty($this->prefixesPsr0)) {
  52239. return call_user_func_array('array_merge', $this->prefixesPsr0);
  52240. }
  52241. return array();
  52242. }
  52243. public function getPrefixesPsr4()
  52244. {
  52245. return $this->prefixDirsPsr4;
  52246. }
  52247. public function getFallbackDirs()
  52248. {
  52249. return $this->fallbackDirsPsr0;
  52250. }
  52251. public function getFallbackDirsPsr4()
  52252. {
  52253. return $this->fallbackDirsPsr4;
  52254. }
  52255. public function getClassMap()
  52256. {
  52257. return $this->classMap;
  52258. }
  52259. public function addClassMap(array $classMap)
  52260. {
  52261. if ($this->classMap) {
  52262. $this->classMap = array_merge($this->classMap, $classMap);
  52263. } else {
  52264. $this->classMap = $classMap;
  52265. }
  52266. }
  52267. public function add($prefix, $paths, $prepend = false)
  52268. {
  52269. if (!$prefix) {
  52270. if ($prepend) {
  52271. $this->fallbackDirsPsr0 = array_merge(
  52272. (array) $paths,
  52273. $this->fallbackDirsPsr0
  52274. );
  52275. } else {
  52276. $this->fallbackDirsPsr0 = array_merge(
  52277. $this->fallbackDirsPsr0,
  52278. (array) $paths
  52279. );
  52280. }
  52281. return;
  52282. }
  52283. $first = $prefix[0];
  52284. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  52285. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  52286. return;
  52287. }
  52288. if ($prepend) {
  52289. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52290. (array) $paths,
  52291. $this->prefixesPsr0[$first][$prefix]
  52292. );
  52293. } else {
  52294. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52295. $this->prefixesPsr0[$first][$prefix],
  52296. (array) $paths
  52297. );
  52298. }
  52299. }
  52300. public function addPsr4($prefix, $paths, $prepend = false)
  52301. {
  52302. if (!$prefix) {
  52303. if ($prepend) {
  52304. $this->fallbackDirsPsr4 = array_merge(
  52305. (array) $paths,
  52306. $this->fallbackDirsPsr4
  52307. );
  52308. } else {
  52309. $this->fallbackDirsPsr4 = array_merge(
  52310. $this->fallbackDirsPsr4,
  52311. (array) $paths
  52312. );
  52313. }
  52314. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  52315. $length = strlen($prefix);
  52316. if ('\\' !== $prefix[$length - 1]) {
  52317. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52318. }
  52319. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52320. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52321. } elseif ($prepend) {
  52322. $this->prefixDirsPsr4[$prefix] = array_merge(
  52323. (array) $paths,
  52324. $this->prefixDirsPsr4[$prefix]
  52325. );
  52326. } else {
  52327. $this->prefixDirsPsr4[$prefix] = array_merge(
  52328. $this->prefixDirsPsr4[$prefix],
  52329. (array) $paths
  52330. );
  52331. }
  52332. }
  52333. public function set($prefix, $paths)
  52334. {
  52335. if (!$prefix) {
  52336. $this->fallbackDirsPsr0 = (array) $paths;
  52337. } else {
  52338. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  52339. }
  52340. }
  52341. public function setPsr4($prefix, $paths)
  52342. {
  52343. if (!$prefix) {
  52344. $this->fallbackDirsPsr4 = (array) $paths;
  52345. } else {
  52346. $length = strlen($prefix);
  52347. if ('\\' !== $prefix[$length - 1]) {
  52348. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52349. }
  52350. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52351. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52352. }
  52353. }
  52354. public function setUseIncludePath($useIncludePath)
  52355. {
  52356. $this->useIncludePath = $useIncludePath;
  52357. }
  52358. public function getUseIncludePath()
  52359. {
  52360. return $this->useIncludePath;
  52361. }
  52362. public function setClassMapAuthoritative($classMapAuthoritative)
  52363. {
  52364. $this->classMapAuthoritative = $classMapAuthoritative;
  52365. }
  52366. public function isClassMapAuthoritative()
  52367. {
  52368. return $this->classMapAuthoritative;
  52369. }
  52370. public function setApcuPrefix($apcuPrefix)
  52371. {
  52372. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  52373. }
  52374. public function getApcuPrefix()
  52375. {
  52376. return $this->apcuPrefix;
  52377. }
  52378. public function register($prepend = false)
  52379. {
  52380. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  52381. }
  52382. public function unregister()
  52383. {
  52384. spl_autoload_unregister(array($this, 'loadClass'));
  52385. }
  52386. public function loadClass($class)
  52387. {
  52388. if ($file = $this->findFile($class)) {
  52389. includeFile($file);
  52390. return true;
  52391. }
  52392. }
  52393. public function findFile($class)
  52394. {
  52395. if (isset($this->classMap[$class])) {
  52396. return $this->classMap[$class];
  52397. }
  52398. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  52399. return false;
  52400. }
  52401. if (null !== $this->apcuPrefix) {
  52402. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  52403. if ($hit) {
  52404. return $file;
  52405. }
  52406. }
  52407. $file = $this->findFileWithExtension($class, '.php');
  52408. if (false === $file && defined('HHVM_VERSION')) {
  52409. $file = $this->findFileWithExtension($class, '.hh');
  52410. }
  52411. if (null !== $this->apcuPrefix) {
  52412. apcu_add($this->apcuPrefix.$class, $file);
  52413. }
  52414. if (false === $file) {
  52415. $this->missingClasses[$class] = true;
  52416. }
  52417. return $file;
  52418. }
  52419. private function findFileWithExtension($class, $ext)
  52420. {
  52421. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  52422. $first = $class[0];
  52423. if (isset($this->prefixLengthsPsr4[$first])) {
  52424. $subPath = $class;
  52425. while (false !== $lastPos = strrpos($subPath, '\\')) {
  52426. $subPath = substr($subPath, 0, $lastPos);
  52427. $search = $subPath . '\\';
  52428. if (isset($this->prefixDirsPsr4[$search])) {
  52429. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  52430. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  52431. if (file_exists($file = $dir . $pathEnd)) {
  52432. return $file;
  52433. }
  52434. }
  52435. }
  52436. }
  52437. }
  52438. foreach ($this->fallbackDirsPsr4 as $dir) {
  52439. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  52440. return $file;
  52441. }
  52442. }
  52443. if (false !== $pos = strrpos($class, '\\')) {
  52444. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  52445. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  52446. } else {
  52447. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  52448. }
  52449. if (isset($this->prefixesPsr0[$first])) {
  52450. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  52451. if (0 === strpos($class, $prefix)) {
  52452. foreach ($dirs as $dir) {
  52453. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52454. return $file;
  52455. }
  52456. }
  52457. }
  52458. }
  52459. }
  52460. foreach ($this->fallbackDirsPsr0 as $dir) {
  52461. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52462. return $file;
  52463. }
  52464. }
  52465. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  52466. return $file;
  52467. }
  52468. return false;
  52469. }
  52470. }
  52471. function includeFile($file)
  52472. {
  52473. include $file;
  52474. }
  52475. ##
  52476. ## Bundle of CA Root Certificates
  52477. ##
  52478. ## Certificate data from Mozilla as of: Wed May 15 03:12:09 2019 GMT
  52479. ##
  52480. ## This is a bundle of X.509 certificates of public Certificate Authorities
  52481. ## (CA). These were automatically extracted from Mozilla's root certificates
  52482. ## file (certdata.txt). This file can be found in the mozilla source tree:
  52483. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  52484. ##
  52485. ## It contains the certificates in PEM format and therefore
  52486. ## can be directly used with curl / libcurl / php_curl, or with
  52487. ## an Apache+mod_ssl webserver for SSL client authentication.
  52488. ## Just configure this file as the SSLCACertificateFile.
  52489. ##
  52490. ## Conversion done with mk-ca-bundle.pl version 1.27.
  52491. ## SHA256: 61eaa79ac46d923f2f74dfe401189424e96fa8736102b47ba2cdb4ea19af2cc8
  52492. ##
  52493. GlobalSign Root CA
  52494. ==================
  52495. -----BEGIN CERTIFICATE-----
  52496. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  52497. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  52498. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  52499. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  52500. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  52501. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  52502. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  52503. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  52504. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  52505. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  52506. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  52507. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  52508. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  52509. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  52510. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  52511. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  52512. -----END CERTIFICATE-----
  52513. GlobalSign Root CA - R2
  52514. =======================
  52515. -----BEGIN CERTIFICATE-----
  52516. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  52517. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52518. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52519. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52520. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  52521. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  52522. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  52523. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  52524. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  52525. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  52526. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  52527. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  52528. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  52529. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  52530. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  52531. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  52532. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  52533. -----END CERTIFICATE-----
  52534. Verisign Class 3 Public Primary Certification Authority - G3
  52535. ============================================================
  52536. -----BEGIN CERTIFICATE-----
  52537. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  52538. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52539. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52540. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  52541. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  52542. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  52543. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  52544. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  52545. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52546. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  52547. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  52548. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  52549. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  52550. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  52551. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  52552. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  52553. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  52554. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  52555. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  52556. -----END CERTIFICATE-----
  52557. Entrust.net Premium 2048 Secure Server CA
  52558. =========================================
  52559. -----BEGIN CERTIFICATE-----
  52560. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  52561. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  52562. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  52563. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  52564. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  52565. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  52566. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  52567. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52568. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  52569. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  52570. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  52571. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  52572. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  52573. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  52574. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  52575. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  52576. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  52577. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  52578. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  52579. -----END CERTIFICATE-----
  52580. Baltimore CyberTrust Root
  52581. =========================
  52582. -----BEGIN CERTIFICATE-----
  52583. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  52584. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  52585. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  52586. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  52587. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  52588. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  52589. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  52590. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  52591. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  52592. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  52593. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  52594. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  52595. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  52596. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  52597. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  52598. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  52599. -----END CERTIFICATE-----
  52600. AddTrust External Root
  52601. ======================
  52602. -----BEGIN CERTIFICATE-----
  52603. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  52604. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  52605. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  52606. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  52607. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  52608. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  52609. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  52610. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  52611. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  52612. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  52613. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  52614. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  52615. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  52616. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  52617. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  52618. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  52619. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  52620. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  52621. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  52622. -----END CERTIFICATE-----
  52623. Entrust Root Certification Authority
  52624. ====================================
  52625. -----BEGIN CERTIFICATE-----
  52626. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  52627. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  52628. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  52629. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  52630. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  52631. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  52632. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  52633. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52634. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  52635. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  52636. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  52637. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  52638. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  52639. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  52640. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  52641. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  52642. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  52643. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  52644. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  52645. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  52646. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  52647. -----END CERTIFICATE-----
  52648. GeoTrust Global CA
  52649. ==================
  52650. -----BEGIN CERTIFICATE-----
  52651. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  52652. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  52653. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  52654. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52655. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  52656. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  52657. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  52658. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  52659. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  52660. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  52661. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  52662. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  52663. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  52664. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  52665. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  52666. Mw==
  52667. -----END CERTIFICATE-----
  52668. GeoTrust Universal CA
  52669. =====================
  52670. -----BEGIN CERTIFICATE-----
  52671. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52672. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  52673. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  52674. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  52675. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  52676. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  52677. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  52678. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  52679. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  52680. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  52681. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  52682. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  52683. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  52684. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  52685. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  52686. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  52687. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  52688. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  52689. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  52690. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  52691. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  52692. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  52693. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  52694. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  52695. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  52696. -----END CERTIFICATE-----
  52697. GeoTrust Universal CA 2
  52698. =======================
  52699. -----BEGIN CERTIFICATE-----
  52700. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52701. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  52702. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  52703. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  52704. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  52705. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  52706. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  52707. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  52708. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  52709. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  52710. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  52711. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  52712. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  52713. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  52714. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  52715. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  52716. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  52717. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  52718. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  52719. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  52720. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  52721. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  52722. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  52723. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  52724. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  52725. -----END CERTIFICATE-----
  52726. Comodo AAA Services root
  52727. ========================
  52728. -----BEGIN CERTIFICATE-----
  52729. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  52730. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  52731. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  52732. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  52733. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  52734. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52735. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  52736. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  52737. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  52738. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  52739. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  52740. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  52741. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  52742. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  52743. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  52744. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  52745. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  52746. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  52747. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  52748. -----END CERTIFICATE-----
  52749. QuoVadis Root CA
  52750. ================
  52751. -----BEGIN CERTIFICATE-----
  52752. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  52753. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  52754. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  52755. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  52756. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  52757. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  52758. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  52759. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  52760. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  52761. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  52762. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  52763. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  52764. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  52765. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  52766. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  52767. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  52768. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  52769. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  52770. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  52771. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  52772. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  52773. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  52774. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  52775. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  52776. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  52777. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  52778. 5nrQNiOKSnQ2+Q==
  52779. -----END CERTIFICATE-----
  52780. QuoVadis Root CA 2
  52781. ==================
  52782. -----BEGIN CERTIFICATE-----
  52783. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52784. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  52785. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52786. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52787. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  52788. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  52789. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  52790. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  52791. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  52792. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  52793. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  52794. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  52795. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  52796. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  52797. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  52798. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  52799. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  52800. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  52801. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  52802. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  52803. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  52804. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  52805. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  52806. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  52807. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  52808. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  52809. -----END CERTIFICATE-----
  52810. QuoVadis Root CA 3
  52811. ==================
  52812. -----BEGIN CERTIFICATE-----
  52813. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52814. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  52815. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52816. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52817. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  52818. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  52819. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  52820. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  52821. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  52822. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  52823. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  52824. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  52825. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  52826. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  52827. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  52828. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  52829. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  52830. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  52831. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  52832. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  52833. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  52834. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  52835. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  52836. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  52837. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  52838. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  52839. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  52840. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  52841. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  52842. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  52843. -----END CERTIFICATE-----
  52844. Security Communication Root CA
  52845. ==============================
  52846. -----BEGIN CERTIFICATE-----
  52847. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52848. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52849. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52850. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52851. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  52852. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  52853. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  52854. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  52855. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  52856. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  52857. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  52858. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  52859. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  52860. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  52861. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  52862. FL39vmwLAw==
  52863. -----END CERTIFICATE-----
  52864. Sonera Class 2 Root CA
  52865. ======================
  52866. -----BEGIN CERTIFICATE-----
  52867. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  52868. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  52869. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  52870. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  52871. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  52872. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  52873. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  52874. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  52875. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  52876. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  52877. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  52878. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  52879. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  52880. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  52881. llpwrN9M
  52882. -----END CERTIFICATE-----
  52883. XRamp Global CA Root
  52884. ====================
  52885. -----BEGIN CERTIFICATE-----
  52886. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  52887. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  52888. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  52889. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  52890. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  52891. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52892. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  52893. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  52894. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  52895. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  52896. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  52897. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52898. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  52899. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  52900. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  52901. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  52902. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  52903. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  52904. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  52905. -----END CERTIFICATE-----
  52906. Go Daddy Class 2 CA
  52907. ===================
  52908. -----BEGIN CERTIFICATE-----
  52909. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  52910. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  52911. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  52912. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  52913. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  52914. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  52915. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  52916. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  52917. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  52918. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  52919. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  52920. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  52921. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  52922. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  52923. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  52924. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  52925. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  52926. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  52927. vZ8=
  52928. -----END CERTIFICATE-----
  52929. Starfield Class 2 CA
  52930. ====================
  52931. -----BEGIN CERTIFICATE-----
  52932. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  52933. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  52934. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  52935. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  52936. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  52937. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  52938. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  52939. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  52940. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  52941. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  52942. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  52943. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  52944. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  52945. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  52946. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  52947. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  52948. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  52949. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  52950. QBFGmh95DmK/D5fs4C8fF5Q=
  52951. -----END CERTIFICATE-----
  52952. Taiwan GRCA
  52953. ===========
  52954. -----BEGIN CERTIFICATE-----
  52955. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  52956. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  52957. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  52958. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52959. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  52960. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  52961. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  52962. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  52963. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  52964. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  52965. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  52966. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  52967. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  52968. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  52969. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  52970. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  52971. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  52972. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  52973. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  52974. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  52975. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  52976. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  52977. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  52978. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  52979. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  52980. -----END CERTIFICATE-----
  52981. DigiCert Assured ID Root CA
  52982. ===========================
  52983. -----BEGIN CERTIFICATE-----
  52984. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  52985. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52986. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  52987. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52988. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  52989. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  52990. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  52991. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  52992. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  52993. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  52994. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  52995. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  52996. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  52997. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  52998. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  52999. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  53000. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  53001. -----END CERTIFICATE-----
  53002. DigiCert Global Root CA
  53003. =======================
  53004. -----BEGIN CERTIFICATE-----
  53005. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  53006. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  53007. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  53008. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  53009. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  53010. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  53011. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  53012. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  53013. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  53014. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  53015. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  53016. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  53017. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  53018. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  53019. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  53020. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  53021. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  53022. -----END CERTIFICATE-----
  53023. DigiCert High Assurance EV Root CA
  53024. ==================================
  53025. -----BEGIN CERTIFICATE-----
  53026. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  53027. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  53028. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  53029. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  53030. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  53031. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  53032. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  53033. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  53034. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  53035. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  53036. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  53037. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  53038. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  53039. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  53040. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  53041. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  53042. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  53043. -----END CERTIFICATE-----
  53044. Certplus Class 2 Primary CA
  53045. ===========================
  53046. -----BEGIN CERTIFICATE-----
  53047. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  53048. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  53049. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  53050. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  53051. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  53052. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  53053. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  53054. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  53055. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  53056. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  53057. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  53058. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  53059. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  53060. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  53061. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  53062. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  53063. l7+ijrRU
  53064. -----END CERTIFICATE-----
  53065. DST Root CA X3
  53066. ==============
  53067. -----BEGIN CERTIFICATE-----
  53068. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  53069. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  53070. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  53071. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  53072. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  53073. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  53074. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  53075. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  53076. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  53077. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  53078. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  53079. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  53080. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  53081. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  53082. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  53083. -----END CERTIFICATE-----
  53084. SwissSign Gold CA - G2
  53085. ======================
  53086. -----BEGIN CERTIFICATE-----
  53087. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  53088. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  53089. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  53090. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  53091. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  53092. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  53093. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  53094. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  53095. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  53096. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  53097. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  53098. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  53099. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  53100. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  53101. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  53102. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  53103. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  53104. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  53105. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  53106. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  53107. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  53108. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  53109. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  53110. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  53111. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  53112. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  53113. -----END CERTIFICATE-----
  53114. SwissSign Silver CA - G2
  53115. ========================
  53116. -----BEGIN CERTIFICATE-----
  53117. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  53118. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  53119. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  53120. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  53121. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  53122. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  53123. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  53124. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  53125. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  53126. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  53127. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  53128. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  53129. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  53130. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  53131. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  53132. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  53133. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  53134. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  53135. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  53136. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  53137. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  53138. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  53139. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  53140. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  53141. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  53142. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  53143. -----END CERTIFICATE-----
  53144. GeoTrust Primary Certification Authority
  53145. ========================================
  53146. -----BEGIN CERTIFICATE-----
  53147. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  53148. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  53149. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  53150. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  53151. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53152. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  53153. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  53154. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  53155. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  53156. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53157. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  53158. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  53159. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  53160. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  53161. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  53162. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  53163. -----END CERTIFICATE-----
  53164. thawte Primary Root CA
  53165. ======================
  53166. -----BEGIN CERTIFICATE-----
  53167. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  53168. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53169. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53170. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  53171. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  53172. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  53173. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  53174. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  53175. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  53176. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  53177. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  53178. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  53179. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  53180. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  53181. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  53182. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  53183. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  53184. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  53185. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  53186. -----END CERTIFICATE-----
  53187. VeriSign Class 3 Public Primary Certification Authority - G5
  53188. ============================================================
  53189. -----BEGIN CERTIFICATE-----
  53190. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  53191. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53192. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53193. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  53194. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  53195. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  53196. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  53197. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  53198. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  53199. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  53200. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  53201. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  53202. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  53203. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  53204. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  53205. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  53206. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  53207. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  53208. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  53209. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  53210. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  53211. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  53212. -----END CERTIFICATE-----
  53213. SecureTrust CA
  53214. ==============
  53215. -----BEGIN CERTIFICATE-----
  53216. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  53217. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  53218. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  53219. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  53220. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  53221. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  53222. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  53223. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  53224. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  53225. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  53226. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  53227. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53228. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  53229. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  53230. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  53231. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  53232. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  53233. -----END CERTIFICATE-----
  53234. Secure Global CA
  53235. ================
  53236. -----BEGIN CERTIFICATE-----
  53237. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  53238. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  53239. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  53240. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  53241. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  53242. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  53243. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  53244. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  53245. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  53246. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  53247. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  53248. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  53249. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  53250. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  53251. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  53252. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  53253. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  53254. -----END CERTIFICATE-----
  53255. COMODO Certification Authority
  53256. ==============================
  53257. -----BEGIN CERTIFICATE-----
  53258. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  53259. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53260. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  53261. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  53262. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  53263. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53264. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  53265. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  53266. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  53267. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  53268. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  53269. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  53270. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  53271. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  53272. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  53273. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  53274. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  53275. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  53276. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  53277. -----END CERTIFICATE-----
  53278. Network Solutions Certificate Authority
  53279. =======================================
  53280. -----BEGIN CERTIFICATE-----
  53281. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  53282. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  53283. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  53284. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  53285. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  53286. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  53287. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  53288. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  53289. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  53290. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  53291. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  53292. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  53293. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  53294. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  53295. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  53296. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  53297. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  53298. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  53299. -----END CERTIFICATE-----
  53300. COMODO ECC Certification Authority
  53301. ==================================
  53302. -----BEGIN CERTIFICATE-----
  53303. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  53304. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53305. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  53306. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  53307. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  53308. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  53309. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  53310. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  53311. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  53312. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  53313. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  53314. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  53315. -----END CERTIFICATE-----
  53316. OISTE WISeKey Global Root GA CA
  53317. ===============================
  53318. -----BEGIN CERTIFICATE-----
  53319. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  53320. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  53321. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  53322. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  53323. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  53324. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  53325. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  53326. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  53327. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  53328. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  53329. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  53330. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  53331. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53332. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  53333. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  53334. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  53335. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  53336. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  53337. -----END CERTIFICATE-----
  53338. Certigna
  53339. ========
  53340. -----BEGIN CERTIFICATE-----
  53341. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  53342. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  53343. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  53344. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  53345. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  53346. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  53347. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  53348. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  53349. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  53350. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  53351. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  53352. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  53353. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  53354. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  53355. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  53356. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  53357. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  53358. -----END CERTIFICATE-----
  53359. Deutsche Telekom Root CA 2
  53360. ==========================
  53361. -----BEGIN CERTIFICATE-----
  53362. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  53363. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  53364. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  53365. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  53366. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  53367. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  53368. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  53369. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  53370. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  53371. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  53372. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  53373. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  53374. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  53375. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  53376. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  53377. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  53378. Cm26OWMohpLzGITY+9HPBVZkVw==
  53379. -----END CERTIFICATE-----
  53380. Cybertrust Global Root
  53381. ======================
  53382. -----BEGIN CERTIFICATE-----
  53383. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  53384. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  53385. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  53386. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  53387. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  53388. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  53389. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  53390. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  53391. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  53392. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  53393. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  53394. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  53395. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  53396. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  53397. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  53398. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  53399. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  53400. -----END CERTIFICATE-----
  53401. ePKI Root Certification Authority
  53402. =================================
  53403. -----BEGIN CERTIFICATE-----
  53404. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  53405. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  53406. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  53407. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  53408. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  53409. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  53410. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  53411. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  53412. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  53413. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  53414. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  53415. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  53416. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  53417. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  53418. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  53419. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  53420. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  53421. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  53422. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  53423. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  53424. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  53425. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  53426. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  53427. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  53428. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  53429. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  53430. -----END CERTIFICATE-----
  53431. certSIGN ROOT CA
  53432. ================
  53433. -----BEGIN CERTIFICATE-----
  53434. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  53435. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  53436. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  53437. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  53438. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  53439. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  53440. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  53441. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  53442. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  53443. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  53444. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  53445. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  53446. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  53447. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  53448. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  53449. -----END CERTIFICATE-----
  53450. GeoTrust Primary Certification Authority - G3
  53451. =============================================
  53452. -----BEGIN CERTIFICATE-----
  53453. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  53454. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  53455. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  53456. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  53457. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  53458. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  53459. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  53460. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  53461. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  53462. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  53463. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  53464. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  53465. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  53466. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  53467. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  53468. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  53469. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  53470. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  53471. -----END CERTIFICATE-----
  53472. thawte Primary Root CA - G2
  53473. ===========================
  53474. -----BEGIN CERTIFICATE-----
  53475. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  53476. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  53477. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  53478. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  53479. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  53480. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  53481. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  53482. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  53483. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  53484. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  53485. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  53486. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  53487. -----END CERTIFICATE-----
  53488. thawte Primary Root CA - G3
  53489. ===========================
  53490. -----BEGIN CERTIFICATE-----
  53491. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  53492. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53493. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53494. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  53495. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  53496. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  53497. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  53498. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53499. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  53500. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  53501. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  53502. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  53503. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  53504. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  53505. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  53506. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  53507. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  53508. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  53509. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  53510. -----END CERTIFICATE-----
  53511. GeoTrust Primary Certification Authority - G2
  53512. =============================================
  53513. -----BEGIN CERTIFICATE-----
  53514. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  53515. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  53516. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  53517. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  53518. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  53519. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  53520. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  53521. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  53522. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  53523. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  53524. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  53525. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  53526. npaqBA+K
  53527. -----END CERTIFICATE-----
  53528. VeriSign Universal Root Certification Authority
  53529. ===============================================
  53530. -----BEGIN CERTIFICATE-----
  53531. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  53532. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53533. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53534. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  53535. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  53536. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  53537. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  53538. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  53539. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  53540. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  53541. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  53542. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  53543. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  53544. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  53545. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  53546. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  53547. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  53548. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  53549. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  53550. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  53551. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  53552. mJO37M2CYfE45k+XmCpajQ==
  53553. -----END CERTIFICATE-----
  53554. VeriSign Class 3 Public Primary Certification Authority - G4
  53555. ============================================================
  53556. -----BEGIN CERTIFICATE-----
  53557. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  53558. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  53559. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  53560. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  53561. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  53562. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  53563. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  53564. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  53565. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  53566. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  53567. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  53568. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  53569. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  53570. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  53571. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  53572. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  53573. -----END CERTIFICATE-----
  53574. NetLock Arany (Class Gold) Főtanúsítvány
  53575. ========================================
  53576. -----BEGIN CERTIFICATE-----
  53577. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  53578. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  53579. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  53580. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  53581. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  53582. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  53583. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  53584. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  53585. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  53586. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  53587. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  53588. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  53589. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  53590. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  53591. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  53592. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  53593. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  53594. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  53595. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  53596. -----END CERTIFICATE-----
  53597. Staat der Nederlanden Root CA - G2
  53598. ==================================
  53599. -----BEGIN CERTIFICATE-----
  53600. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53601. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53602. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  53603. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53604. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  53605. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  53606. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  53607. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  53608. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  53609. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  53610. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  53611. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  53612. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  53613. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  53614. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  53615. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  53616. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  53617. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  53618. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  53619. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  53620. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  53621. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  53622. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  53623. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  53624. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  53625. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  53626. 66+KAQ==
  53627. -----END CERTIFICATE-----
  53628. Hongkong Post Root CA 1
  53629. =======================
  53630. -----BEGIN CERTIFICATE-----
  53631. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  53632. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  53633. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  53634. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  53635. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  53636. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  53637. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  53638. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  53639. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  53640. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  53641. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  53642. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  53643. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  53644. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  53645. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  53646. -----END CERTIFICATE-----
  53647. SecureSign RootCA11
  53648. ===================
  53649. -----BEGIN CERTIFICATE-----
  53650. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  53651. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  53652. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  53653. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  53654. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  53655. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  53656. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  53657. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  53658. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  53659. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  53660. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  53661. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  53662. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  53663. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  53664. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  53665. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  53666. -----END CERTIFICATE-----
  53667. Microsec e-Szigno Root CA 2009
  53668. ==============================
  53669. -----BEGIN CERTIFICATE-----
  53670. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  53671. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  53672. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  53673. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  53674. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  53675. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  53676. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  53677. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  53678. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  53679. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  53680. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  53681. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  53682. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  53683. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  53684. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  53685. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  53686. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  53687. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  53688. LXpUq3DDfSJlgnCW
  53689. -----END CERTIFICATE-----
  53690. GlobalSign Root CA - R3
  53691. =======================
  53692. -----BEGIN CERTIFICATE-----
  53693. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  53694. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  53695. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  53696. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  53697. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  53698. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  53699. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  53700. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  53701. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  53702. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53703. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  53704. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  53705. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  53706. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  53707. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  53708. kpeDMdmztcpHWD9f
  53709. -----END CERTIFICATE-----
  53710. Autoridad de Certificacion Firmaprofesional CIF A62634068
  53711. =========================================================
  53712. -----BEGIN CERTIFICATE-----
  53713. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  53714. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  53715. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  53716. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  53717. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  53718. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  53719. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  53720. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  53721. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  53722. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  53723. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  53724. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  53725. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  53726. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  53727. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  53728. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  53729. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  53730. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  53731. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  53732. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  53733. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  53734. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  53735. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  53736. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  53737. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  53738. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  53739. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  53740. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  53741. -----END CERTIFICATE-----
  53742. Izenpe.com
  53743. ==========
  53744. -----BEGIN CERTIFICATE-----
  53745. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  53746. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  53747. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  53748. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  53749. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  53750. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  53751. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  53752. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  53753. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  53754. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  53755. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  53756. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  53757. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  53758. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  53759. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  53760. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  53761. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53762. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  53763. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  53764. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  53765. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  53766. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  53767. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  53768. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  53769. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  53770. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  53771. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  53772. -----END CERTIFICATE-----
  53773. Chambers of Commerce Root - 2008
  53774. ================================
  53775. -----BEGIN CERTIFICATE-----
  53776. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  53777. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53778. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53779. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  53780. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  53781. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  53782. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  53783. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  53784. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  53785. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  53786. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  53787. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  53788. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  53789. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  53790. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  53791. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  53792. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  53793. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  53794. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  53795. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  53796. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  53797. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  53798. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  53799. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  53800. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  53801. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  53802. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  53803. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  53804. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  53805. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  53806. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  53807. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  53808. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  53809. -----END CERTIFICATE-----
  53810. Global Chambersign Root - 2008
  53811. ==============================
  53812. -----BEGIN CERTIFICATE-----
  53813. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  53814. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53815. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53816. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  53817. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  53818. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  53819. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  53820. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  53821. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  53822. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  53823. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  53824. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  53825. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  53826. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  53827. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  53828. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  53829. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  53830. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  53831. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  53832. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  53833. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  53834. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  53835. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  53836. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  53837. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  53838. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  53839. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  53840. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  53841. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  53842. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  53843. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  53844. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  53845. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  53846. -----END CERTIFICATE-----
  53847. Go Daddy Root Certificate Authority - G2
  53848. ========================================
  53849. -----BEGIN CERTIFICATE-----
  53850. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53851. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  53852. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  53853. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  53854. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  53855. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  53856. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  53857. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  53858. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  53859. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  53860. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  53861. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  53862. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  53863. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  53864. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  53865. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  53866. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  53867. -----END CERTIFICATE-----
  53868. Starfield Root Certificate Authority - G2
  53869. =========================================
  53870. -----BEGIN CERTIFICATE-----
  53871. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53872. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53873. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  53874. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  53875. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  53876. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  53877. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  53878. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  53879. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  53880. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  53881. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  53882. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53883. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  53884. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  53885. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  53886. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  53887. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  53888. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  53889. -----END CERTIFICATE-----
  53890. Starfield Services Root Certificate Authority - G2
  53891. ==================================================
  53892. -----BEGIN CERTIFICATE-----
  53893. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53894. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53895. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  53896. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  53897. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  53898. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  53899. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  53900. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  53901. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  53902. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  53903. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  53904. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  53905. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  53906. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  53907. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  53908. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  53909. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  53910. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  53911. -----END CERTIFICATE-----
  53912. AffirmTrust Commercial
  53913. ======================
  53914. -----BEGIN CERTIFICATE-----
  53915. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53916. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  53917. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53918. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  53919. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  53920. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  53921. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  53922. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  53923. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  53924. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53925. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  53926. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  53927. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  53928. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  53929. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  53930. -----END CERTIFICATE-----
  53931. AffirmTrust Networking
  53932. ======================
  53933. -----BEGIN CERTIFICATE-----
  53934. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53935. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  53936. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53937. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  53938. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  53939. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  53940. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  53941. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  53942. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  53943. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53944. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  53945. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  53946. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  53947. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  53948. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  53949. -----END CERTIFICATE-----
  53950. AffirmTrust Premium
  53951. ===================
  53952. -----BEGIN CERTIFICATE-----
  53953. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  53954. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  53955. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  53956. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53957. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  53958. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  53959. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  53960. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  53961. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  53962. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  53963. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  53964. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  53965. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  53966. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  53967. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  53968. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  53969. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  53970. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  53971. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  53972. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  53973. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  53974. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  53975. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  53976. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  53977. -----END CERTIFICATE-----
  53978. AffirmTrust Premium ECC
  53979. =======================
  53980. -----BEGIN CERTIFICATE-----
  53981. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  53982. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  53983. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  53984. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  53985. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  53986. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  53987. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  53988. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  53989. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  53990. eQ==
  53991. -----END CERTIFICATE-----
  53992. Certum Trusted Network CA
  53993. =========================
  53994. -----BEGIN CERTIFICATE-----
  53995. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  53996. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  53997. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  53998. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  53999. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54000. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  54001. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  54002. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  54003. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  54004. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  54005. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  54006. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  54007. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  54008. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  54009. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  54010. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  54011. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  54012. -----END CERTIFICATE-----
  54013. TWCA Root Certification Authority
  54014. =================================
  54015. -----BEGIN CERTIFICATE-----
  54016. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  54017. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  54018. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  54019. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  54020. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  54021. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  54022. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  54023. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  54024. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  54025. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  54026. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  54027. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  54028. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  54029. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  54030. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  54031. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  54032. -----END CERTIFICATE-----
  54033. Security Communication RootCA2
  54034. ==============================
  54035. -----BEGIN CERTIFICATE-----
  54036. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  54037. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  54038. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  54039. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  54040. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54041. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  54042. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  54043. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  54044. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  54045. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  54046. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  54047. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  54048. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  54049. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  54050. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  54051. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  54052. -----END CERTIFICATE-----
  54053. EC-ACC
  54054. ======
  54055. -----BEGIN CERTIFICATE-----
  54056. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  54057. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  54058. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  54059. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  54060. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  54061. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  54062. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  54063. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  54064. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  54065. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  54066. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  54067. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  54068. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  54069. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  54070. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  54071. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  54072. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  54073. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  54074. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  54075. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  54076. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  54077. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  54078. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  54079. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  54080. 5EI=
  54081. -----END CERTIFICATE-----
  54082. Hellenic Academic and Research Institutions RootCA 2011
  54083. =======================================================
  54084. -----BEGIN CERTIFICATE-----
  54085. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  54086. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  54087. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54088. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  54089. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54090. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  54091. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54092. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  54093. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  54094. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  54095. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  54096. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  54097. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  54098. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  54099. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  54100. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  54101. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  54102. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  54103. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  54104. -----END CERTIFICATE-----
  54105. Actalis Authentication Root CA
  54106. ==============================
  54107. -----BEGIN CERTIFICATE-----
  54108. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  54109. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  54110. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  54111. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  54112. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  54113. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  54114. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  54115. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  54116. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  54117. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  54118. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  54119. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  54120. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  54121. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  54122. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  54123. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  54124. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  54125. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  54126. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  54127. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  54128. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  54129. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  54130. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  54131. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  54132. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  54133. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  54134. -----END CERTIFICATE-----
  54135. Trustis FPS Root CA
  54136. ===================
  54137. -----BEGIN CERTIFICATE-----
  54138. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  54139. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  54140. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  54141. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  54142. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  54143. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  54144. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  54145. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  54146. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  54147. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  54148. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  54149. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  54150. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  54151. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  54152. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  54153. iB6XzCGcKQENZetX2fNXlrtIzYE=
  54154. -----END CERTIFICATE-----
  54155. Buypass Class 2 Root CA
  54156. =======================
  54157. -----BEGIN CERTIFICATE-----
  54158. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54159. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  54160. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54161. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  54162. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  54163. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  54164. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  54165. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  54166. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  54167. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  54168. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  54169. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  54170. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  54171. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54172. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54173. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  54174. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  54175. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  54176. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  54177. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  54178. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  54179. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  54180. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  54181. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  54182. rJgWVqA=
  54183. -----END CERTIFICATE-----
  54184. Buypass Class 3 Root CA
  54185. =======================
  54186. -----BEGIN CERTIFICATE-----
  54187. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54188. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  54189. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54190. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  54191. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  54192. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  54193. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  54194. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  54195. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  54196. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  54197. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  54198. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  54199. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  54200. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54201. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54202. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  54203. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  54204. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  54205. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  54206. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  54207. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  54208. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  54209. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  54210. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  54211. Cp/HuZc=
  54212. -----END CERTIFICATE-----
  54213. T-TeleSec GlobalRoot Class 3
  54214. ============================
  54215. -----BEGIN CERTIFICATE-----
  54216. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54217. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54218. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  54219. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54220. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54221. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  54222. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  54223. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  54224. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  54225. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  54226. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  54227. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  54228. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  54229. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  54230. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  54231. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  54232. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  54233. -----END CERTIFICATE-----
  54234. EE Certification Centre Root CA
  54235. ===============================
  54236. -----BEGIN CERTIFICATE-----
  54237. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  54238. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  54239. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  54240. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  54241. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  54242. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  54243. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  54244. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  54245. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  54246. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  54247. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  54248. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  54249. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  54250. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  54251. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  54252. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  54253. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  54254. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  54255. dcGWxZ0=
  54256. -----END CERTIFICATE-----
  54257. D-TRUST Root Class 3 CA 2 2009
  54258. ==============================
  54259. -----BEGIN CERTIFICATE-----
  54260. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54261. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  54262. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  54263. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  54264. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  54265. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  54266. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  54267. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  54268. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  54269. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  54270. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  54271. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  54272. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  54273. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  54274. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  54275. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  54276. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  54277. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  54278. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  54279. -----END CERTIFICATE-----
  54280. D-TRUST Root Class 3 CA 2 EV 2009
  54281. =================================
  54282. -----BEGIN CERTIFICATE-----
  54283. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54284. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54285. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54286. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54287. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  54288. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  54289. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  54290. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  54291. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  54292. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  54293. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  54294. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  54295. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  54296. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  54297. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  54298. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  54299. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  54300. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  54301. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  54302. w9y4AyHqnxbxLFS1
  54303. -----END CERTIFICATE-----
  54304. CA Disig Root R2
  54305. ================
  54306. -----BEGIN CERTIFICATE-----
  54307. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  54308. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  54309. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  54310. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  54311. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  54312. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  54313. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  54314. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  54315. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  54316. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  54317. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  54318. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  54319. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  54320. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  54321. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  54322. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  54323. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  54324. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  54325. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  54326. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  54327. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  54328. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  54329. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  54330. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  54331. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  54332. -----END CERTIFICATE-----
  54333. ACCVRAIZ1
  54334. =========
  54335. -----BEGIN CERTIFICATE-----
  54336. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  54337. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  54338. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  54339. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54340. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  54341. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  54342. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  54343. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  54344. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  54345. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  54346. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  54347. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  54348. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  54349. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  54350. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  54351. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  54352. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  54353. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  54354. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  54355. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  54356. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  54357. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  54358. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  54359. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  54360. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  54361. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  54362. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  54363. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  54364. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  54365. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  54366. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  54367. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  54368. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  54369. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  54370. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  54371. EfbRD0tVNEYqi4Y7
  54372. -----END CERTIFICATE-----
  54373. TWCA Global Root CA
  54374. ===================
  54375. -----BEGIN CERTIFICATE-----
  54376. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  54377. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  54378. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  54379. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  54380. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  54381. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  54382. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  54383. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  54384. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  54385. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  54386. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  54387. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  54388. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  54389. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  54390. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  54391. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  54392. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  54393. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  54394. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  54395. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  54396. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  54397. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  54398. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  54399. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  54400. -----END CERTIFICATE-----
  54401. TeliaSonera Root CA v1
  54402. ======================
  54403. -----BEGIN CERTIFICATE-----
  54404. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  54405. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  54406. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  54407. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  54408. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  54409. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  54410. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  54411. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  54412. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  54413. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  54414. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  54415. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  54416. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  54417. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  54418. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  54419. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  54420. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  54421. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  54422. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  54423. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  54424. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  54425. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  54426. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  54427. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  54428. -----END CERTIFICATE-----
  54429. E-Tugra Certification Authority
  54430. ===============================
  54431. -----BEGIN CERTIFICATE-----
  54432. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  54433. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  54434. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  54435. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  54436. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  54437. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  54438. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  54439. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54440. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  54441. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  54442. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  54443. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  54444. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  54445. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  54446. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  54447. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  54448. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  54449. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  54450. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  54451. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  54452. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  54453. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  54454. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  54455. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  54456. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  54457. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  54458. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  54459. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  54460. C7TbO6Orb1wdtn7os4I07QZcJA==
  54461. -----END CERTIFICATE-----
  54462. T-TeleSec GlobalRoot Class 2
  54463. ============================
  54464. -----BEGIN CERTIFICATE-----
  54465. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54466. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54467. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  54468. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54469. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54470. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  54471. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  54472. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  54473. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  54474. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  54475. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  54476. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  54477. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  54478. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  54479. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  54480. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  54481. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  54482. -----END CERTIFICATE-----
  54483. Atos TrustedRoot 2011
  54484. =====================
  54485. -----BEGIN CERTIFICATE-----
  54486. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  54487. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  54488. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  54489. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  54490. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  54491. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  54492. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  54493. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  54494. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  54495. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  54496. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  54497. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  54498. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  54499. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  54500. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  54501. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  54502. -----END CERTIFICATE-----
  54503. QuoVadis Root CA 1 G3
  54504. =====================
  54505. -----BEGIN CERTIFICATE-----
  54506. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54507. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54508. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  54509. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  54510. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  54511. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  54512. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  54513. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  54514. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  54515. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  54516. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  54517. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  54518. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  54519. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54520. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  54521. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  54522. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  54523. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  54524. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  54525. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  54526. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  54527. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  54528. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  54529. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  54530. hMJKzRwuJIczYOXD
  54531. -----END CERTIFICATE-----
  54532. QuoVadis Root CA 2 G3
  54533. =====================
  54534. -----BEGIN CERTIFICATE-----
  54535. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54536. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54537. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  54538. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  54539. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  54540. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  54541. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  54542. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  54543. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  54544. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  54545. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  54546. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  54547. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  54548. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54549. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  54550. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  54551. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  54552. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  54553. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  54554. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  54555. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  54556. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  54557. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  54558. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  54559. O3jtZsSOeWmD3n+M
  54560. -----END CERTIFICATE-----
  54561. QuoVadis Root CA 3 G3
  54562. =====================
  54563. -----BEGIN CERTIFICATE-----
  54564. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  54565. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54566. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  54567. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  54568. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  54569. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  54570. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  54571. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  54572. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  54573. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  54574. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  54575. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  54576. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  54577. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54578. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  54579. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  54580. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  54581. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  54582. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  54583. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  54584. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  54585. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  54586. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  54587. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  54588. PpxxVJkES/1Y+Zj0
  54589. -----END CERTIFICATE-----
  54590. DigiCert Assured ID Root G2
  54591. ===========================
  54592. -----BEGIN CERTIFICATE-----
  54593. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  54594. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54595. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  54596. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54597. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  54598. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  54599. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  54600. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  54601. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  54602. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  54603. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  54604. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  54605. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  54606. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  54607. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  54608. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  54609. IhNzbM8m9Yop5w==
  54610. -----END CERTIFICATE-----
  54611. DigiCert Assured ID Root G3
  54612. ===========================
  54613. -----BEGIN CERTIFICATE-----
  54614. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  54615. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  54616. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54617. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54618. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  54619. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  54620. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  54621. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  54622. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  54623. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  54624. 1vUhZscv6pZjamVFkpUBtA==
  54625. -----END CERTIFICATE-----
  54626. DigiCert Global Root G2
  54627. =======================
  54628. -----BEGIN CERTIFICATE-----
  54629. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  54630. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54631. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  54632. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54633. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  54634. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  54635. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  54636. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  54637. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  54638. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  54639. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  54640. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  54641. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  54642. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  54643. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  54644. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  54645. MrY=
  54646. -----END CERTIFICATE-----
  54647. DigiCert Global Root G3
  54648. =======================
  54649. -----BEGIN CERTIFICATE-----
  54650. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  54651. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  54652. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  54653. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  54654. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  54655. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  54656. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  54657. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  54658. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  54659. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  54660. VOKa5Vt8sycX
  54661. -----END CERTIFICATE-----
  54662. DigiCert Trusted Root G4
  54663. ========================
  54664. -----BEGIN CERTIFICATE-----
  54665. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  54666. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  54667. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54668. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54669. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  54670. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  54671. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  54672. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  54673. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  54674. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  54675. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  54676. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  54677. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  54678. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  54679. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  54680. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  54681. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  54682. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  54683. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  54684. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  54685. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  54686. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  54687. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  54688. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  54689. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  54690. 82Z+
  54691. -----END CERTIFICATE-----
  54692. COMODO RSA Certification Authority
  54693. ==================================
  54694. -----BEGIN CERTIFICATE-----
  54695. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  54696. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54697. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  54698. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  54699. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54700. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  54701. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  54702. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  54703. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  54704. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  54705. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  54706. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  54707. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  54708. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  54709. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  54710. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  54711. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  54712. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  54713. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  54714. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  54715. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  54716. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  54717. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  54718. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  54719. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  54720. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  54721. LaZRfyHBNVOFBkpdn627G190
  54722. -----END CERTIFICATE-----
  54723. USERTrust RSA Certification Authority
  54724. =====================================
  54725. -----BEGIN CERTIFICATE-----
  54726. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  54727. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54728. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54729. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  54730. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54731. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54732. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  54733. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  54734. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  54735. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  54736. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  54737. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  54738. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  54739. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  54740. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  54741. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  54742. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  54743. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  54744. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  54745. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  54746. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  54747. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  54748. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  54749. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  54750. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  54751. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  54752. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  54753. -----END CERTIFICATE-----
  54754. USERTrust ECC Certification Authority
  54755. =====================================
  54756. -----BEGIN CERTIFICATE-----
  54757. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  54758. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54759. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54760. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  54761. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54762. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54763. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  54764. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  54765. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  54766. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  54767. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  54768. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  54769. -----END CERTIFICATE-----
  54770. GlobalSign ECC Root CA - R4
  54771. ===========================
  54772. -----BEGIN CERTIFICATE-----
  54773. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  54774. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54775. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54776. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54777. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  54778. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  54779. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  54780. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  54781. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  54782. -----END CERTIFICATE-----
  54783. GlobalSign ECC Root CA - R5
  54784. ===========================
  54785. -----BEGIN CERTIFICATE-----
  54786. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  54787. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54788. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54789. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54790. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  54791. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  54792. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  54793. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  54794. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  54795. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  54796. -----END CERTIFICATE-----
  54797. Staat der Nederlanden Root CA - G3
  54798. ==================================
  54799. -----BEGIN CERTIFICATE-----
  54800. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54801. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54802. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  54803. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  54804. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  54805. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  54806. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  54807. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  54808. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  54809. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  54810. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  54811. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  54812. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  54813. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  54814. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  54815. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  54816. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  54817. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  54818. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  54819. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  54820. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  54821. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  54822. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  54823. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  54824. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  54825. -----END CERTIFICATE-----
  54826. Staat der Nederlanden EV Root CA
  54827. ================================
  54828. -----BEGIN CERTIFICATE-----
  54829. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54830. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54831. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  54832. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  54833. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  54834. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  54835. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  54836. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  54837. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  54838. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  54839. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  54840. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  54841. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  54842. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  54843. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  54844. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  54845. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  54846. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  54847. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  54848. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  54849. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  54850. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  54851. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  54852. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  54853. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  54854. -----END CERTIFICATE-----
  54855. IdenTrust Commercial Root CA 1
  54856. ==============================
  54857. -----BEGIN CERTIFICATE-----
  54858. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  54859. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  54860. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  54861. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  54862. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  54863. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  54864. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  54865. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  54866. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  54867. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  54868. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  54869. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  54870. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  54871. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  54872. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  54873. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  54874. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  54875. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  54876. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  54877. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  54878. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  54879. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  54880. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  54881. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  54882. cGzM7vRX+Bi6hG6H
  54883. -----END CERTIFICATE-----
  54884. IdenTrust Public Sector Root CA 1
  54885. =================================
  54886. -----BEGIN CERTIFICATE-----
  54887. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  54888. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  54889. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  54890. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  54891. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  54892. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  54893. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  54894. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  54895. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  54896. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  54897. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  54898. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  54899. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  54900. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  54901. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  54902. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  54903. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  54904. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  54905. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  54906. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  54907. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  54908. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  54909. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  54910. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  54911. 3Wl9af0AVqW3rLatt8o+Ae+c
  54912. -----END CERTIFICATE-----
  54913. Entrust Root Certification Authority - G2
  54914. =========================================
  54915. -----BEGIN CERTIFICATE-----
  54916. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  54917. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  54918. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  54919. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  54920. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  54921. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  54922. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  54923. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  54924. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  54925. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  54926. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  54927. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  54928. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  54929. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  54930. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  54931. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  54932. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  54933. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  54934. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  54935. e4pIb4tF9g==
  54936. -----END CERTIFICATE-----
  54937. Entrust Root Certification Authority - EC1
  54938. ==========================================
  54939. -----BEGIN CERTIFICATE-----
  54940. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  54941. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  54942. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  54943. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54944. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  54945. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  54946. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  54947. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  54948. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  54949. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  54950. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  54951. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  54952. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  54953. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  54954. -----END CERTIFICATE-----
  54955. CFCA EV ROOT
  54956. ============
  54957. -----BEGIN CERTIFICATE-----
  54958. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  54959. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  54960. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  54961. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  54962. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  54963. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  54964. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  54965. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  54966. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  54967. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  54968. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  54969. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  54970. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  54971. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  54972. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  54973. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  54974. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  54975. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  54976. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  54977. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  54978. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  54979. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  54980. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  54981. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  54982. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  54983. -----END CERTIFICATE-----
  54984. Certinomis - Root CA
  54985. ====================
  54986. -----BEGIN CERTIFICATE-----
  54987. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  54988. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  54989. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  54990. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  54991. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  54992. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  54993. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  54994. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  54995. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  54996. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  54997. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  54998. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  54999. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  55000. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  55001. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  55002. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  55003. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  55004. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  55005. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  55006. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  55007. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  55008. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  55009. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  55010. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  55011. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  55012. hkIGuUE=
  55013. -----END CERTIFICATE-----
  55014. OISTE WISeKey Global Root GB CA
  55015. ===============================
  55016. -----BEGIN CERTIFICATE-----
  55017. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  55018. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  55019. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  55020. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  55021. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  55022. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  55023. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  55024. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  55025. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  55026. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  55027. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  55028. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  55029. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  55030. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  55031. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  55032. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  55033. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  55034. -----END CERTIFICATE-----
  55035. SZAFIR ROOT CA2
  55036. ===============
  55037. -----BEGIN CERTIFICATE-----
  55038. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  55039. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  55040. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  55041. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  55042. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  55043. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  55044. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  55045. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  55046. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  55047. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  55048. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  55049. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  55050. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  55051. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  55052. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  55053. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  55054. -----END CERTIFICATE-----
  55055. Certum Trusted Network CA 2
  55056. ===========================
  55057. -----BEGIN CERTIFICATE-----
  55058. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  55059. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  55060. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  55061. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  55062. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  55063. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  55064. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  55065. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  55066. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  55067. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  55068. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  55069. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  55070. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  55071. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  55072. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  55073. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55074. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  55075. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  55076. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  55077. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  55078. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  55079. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  55080. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  55081. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  55082. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  55083. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  55084. zAYspsbiDrW5viSP
  55085. -----END CERTIFICATE-----
  55086. Hellenic Academic and Research Institutions RootCA 2015
  55087. =======================================================
  55088. -----BEGIN CERTIFICATE-----
  55089. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  55090. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  55091. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  55092. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  55093. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  55094. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  55095. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  55096. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  55097. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  55098. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  55099. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  55100. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  55101. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  55102. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  55103. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  55104. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  55105. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55106. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  55107. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  55108. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  55109. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  55110. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  55111. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  55112. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  55113. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  55114. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  55115. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  55116. p/UsQu0yrbYhnr68
  55117. -----END CERTIFICATE-----
  55118. Hellenic Academic and Research Institutions ECC RootCA 2015
  55119. ===========================================================
  55120. -----BEGIN CERTIFICATE-----
  55121. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  55122. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  55123. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  55124. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  55125. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  55126. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  55127. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  55128. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  55129. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  55130. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55131. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  55132. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  55133. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  55134. -----END CERTIFICATE-----
  55135. ISRG Root X1
  55136. ============
  55137. -----BEGIN CERTIFICATE-----
  55138. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  55139. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  55140. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  55141. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  55142. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  55143. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  55144. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  55145. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  55146. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  55147. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  55148. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  55149. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  55150. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  55151. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  55152. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  55153. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  55154. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  55155. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  55156. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  55157. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  55158. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  55159. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  55160. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  55161. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  55162. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  55163. -----END CERTIFICATE-----
  55164. AC RAIZ FNMT-RCM
  55165. ================
  55166. -----BEGIN CERTIFICATE-----
  55167. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  55168. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  55169. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  55170. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55171. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  55172. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  55173. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  55174. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  55175. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  55176. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  55177. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  55178. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  55179. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  55180. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  55181. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  55182. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  55183. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  55184. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  55185. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  55186. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  55187. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  55188. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  55189. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  55190. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  55191. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  55192. -----END CERTIFICATE-----
  55193. Amazon Root CA 1
  55194. ================
  55195. -----BEGIN CERTIFICATE-----
  55196. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  55197. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  55198. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55199. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  55200. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  55201. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  55202. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  55203. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  55204. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  55205. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  55206. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  55207. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  55208. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  55209. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  55210. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  55211. -----END CERTIFICATE-----
  55212. Amazon Root CA 2
  55213. ================
  55214. -----BEGIN CERTIFICATE-----
  55215. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  55216. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  55217. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55218. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55219. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  55220. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  55221. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  55222. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  55223. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  55224. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  55225. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  55226. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  55227. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  55228. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  55229. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  55230. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  55231. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  55232. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  55233. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  55234. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  55235. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  55236. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  55237. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  55238. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  55239. -----END CERTIFICATE-----
  55240. Amazon Root CA 3
  55241. ================
  55242. -----BEGIN CERTIFICATE-----
  55243. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  55244. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  55245. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55246. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  55247. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  55248. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  55249. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  55250. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  55251. -----END CERTIFICATE-----
  55252. Amazon Root CA 4
  55253. ================
  55254. -----BEGIN CERTIFICATE-----
  55255. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  55256. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  55257. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55258. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  55259. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  55260. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  55261. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  55262. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  55263. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  55264. -----END CERTIFICATE-----
  55265. LuxTrust Global Root 2
  55266. ======================
  55267. -----BEGIN CERTIFICATE-----
  55268. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  55269. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  55270. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  55271. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  55272. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  55273. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  55274. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  55275. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  55276. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  55277. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  55278. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  55279. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  55280. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  55281. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  55282. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  55283. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  55284. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  55285. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  55286. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  55287. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  55288. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  55289. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  55290. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  55291. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  55292. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  55293. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  55294. -----END CERTIFICATE-----
  55295. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  55296. =============================================
  55297. -----BEGIN CERTIFICATE-----
  55298. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  55299. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  55300. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  55301. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  55302. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  55303. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  55304. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  55305. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  55306. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55307. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  55308. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  55309. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  55310. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  55311. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  55312. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  55313. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  55314. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  55315. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  55316. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  55317. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  55318. -----END CERTIFICATE-----
  55319. GDCA TrustAUTH R5 ROOT
  55320. ======================
  55321. -----BEGIN CERTIFICATE-----
  55322. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  55323. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  55324. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  55325. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  55326. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  55327. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  55328. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  55329. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  55330. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  55331. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  55332. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  55333. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  55334. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  55335. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  55336. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  55337. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  55338. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  55339. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  55340. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  55341. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  55342. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  55343. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  55344. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  55345. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  55346. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  55347. -----END CERTIFICATE-----
  55348. TrustCor RootCert CA-1
  55349. ======================
  55350. -----BEGIN CERTIFICATE-----
  55351. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  55352. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55353. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55354. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  55355. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  55356. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  55357. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  55358. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  55359. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  55360. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  55361. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  55362. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  55363. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  55364. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55365. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  55366. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  55367. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  55368. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  55369. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  55370. -----END CERTIFICATE-----
  55371. TrustCor RootCert CA-2
  55372. ======================
  55373. -----BEGIN CERTIFICATE-----
  55374. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  55375. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  55376. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  55377. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  55378. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  55379. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  55380. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  55381. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  55382. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  55383. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  55384. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  55385. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  55386. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  55387. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  55388. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  55389. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  55390. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  55391. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  55392. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  55393. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  55394. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  55395. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  55396. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  55397. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  55398. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  55399. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  55400. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  55401. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  55402. -----END CERTIFICATE-----
  55403. TrustCor ECA-1
  55404. ==============
  55405. -----BEGIN CERTIFICATE-----
  55406. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  55407. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55408. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55409. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  55410. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  55411. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  55412. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  55413. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  55414. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  55415. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  55416. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  55417. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  55418. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  55419. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  55420. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  55421. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  55422. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  55423. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  55424. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  55425. -----END CERTIFICATE-----
  55426. SSL.com Root Certification Authority RSA
  55427. ========================================
  55428. -----BEGIN CERTIFICATE-----
  55429. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  55430. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  55431. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  55432. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55433. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  55434. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55435. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  55436. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  55437. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  55438. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  55439. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  55440. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  55441. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  55442. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  55443. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  55444. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  55445. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  55446. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  55447. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  55448. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  55449. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  55450. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  55451. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  55452. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  55453. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  55454. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  55455. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  55456. -----END CERTIFICATE-----
  55457. SSL.com Root Certification Authority ECC
  55458. ========================================
  55459. -----BEGIN CERTIFICATE-----
  55460. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  55461. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  55462. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  55463. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  55464. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  55465. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  55466. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  55467. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  55468. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  55469. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  55470. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  55471. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  55472. -----END CERTIFICATE-----
  55473. SSL.com EV Root Certification Authority RSA R2
  55474. ==============================================
  55475. -----BEGIN CERTIFICATE-----
  55476. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  55477. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  55478. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  55479. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  55480. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  55481. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  55482. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  55483. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  55484. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  55485. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  55486. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  55487. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  55488. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  55489. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  55490. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  55491. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  55492. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  55493. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  55494. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  55495. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  55496. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  55497. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  55498. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  55499. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  55500. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  55501. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  55502. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  55503. -----END CERTIFICATE-----
  55504. SSL.com EV Root Certification Authority ECC
  55505. ===========================================
  55506. -----BEGIN CERTIFICATE-----
  55507. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  55508. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  55509. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  55510. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55511. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  55512. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  55513. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  55514. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  55515. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  55516. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  55517. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  55518. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  55519. -----END CERTIFICATE-----
  55520. GlobalSign Root CA - R6
  55521. =======================
  55522. -----BEGIN CERTIFICATE-----
  55523. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  55524. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  55525. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  55526. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  55527. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  55528. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  55529. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  55530. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  55531. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  55532. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  55533. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  55534. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  55535. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  55536. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  55537. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  55538. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  55539. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  55540. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  55541. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  55542. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  55543. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  55544. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  55545. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  55546. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  55547. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  55548. -----END CERTIFICATE-----
  55549. OISTE WISeKey Global Root GC CA
  55550. ===============================
  55551. -----BEGIN CERTIFICATE-----
  55552. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  55553. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  55554. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  55555. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  55556. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  55557. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  55558. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  55559. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55560. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  55561. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  55562. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  55563. -----END CERTIFICATE-----
  55564. GTS Root R1
  55565. ===========
  55566. -----BEGIN CERTIFICATE-----
  55567. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55568. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55569. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55570. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  55571. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  55572. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  55573. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  55574. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  55575. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  55576. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  55577. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  55578. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  55579. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  55580. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55581. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  55582. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  55583. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  55584. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  55585. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  55586. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  55587. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  55588. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  55589. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  55590. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  55591. CFF1pkgl
  55592. -----END CERTIFICATE-----
  55593. GTS Root R2
  55594. ===========
  55595. -----BEGIN CERTIFICATE-----
  55596. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55597. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55598. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55599. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  55600. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  55601. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  55602. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  55603. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  55604. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  55605. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  55606. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  55607. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  55608. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  55609. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55610. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  55611. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  55612. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  55613. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  55614. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  55615. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  55616. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  55617. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  55618. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  55619. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  55620. o/DUhgkC
  55621. -----END CERTIFICATE-----
  55622. GTS Root R3
  55623. ===========
  55624. -----BEGIN CERTIFICATE-----
  55625. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55626. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55627. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55628. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  55629. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  55630. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  55631. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  55632. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  55633. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  55634. KaqW04MjyaR7YbPMAuhd
  55635. -----END CERTIFICATE-----
  55636. GTS Root R4
  55637. ===========
  55638. -----BEGIN CERTIFICATE-----
  55639. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55640. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55641. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55642. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  55643. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  55644. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  55645. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  55646. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  55647. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  55648. zPKwTdb+mciUqXWi4w==
  55649. -----END CERTIFICATE-----
  55650. UCA Global G2 Root
  55651. ==================
  55652. -----BEGIN CERTIFICATE-----
  55653. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  55654. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  55655. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  55656. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55657. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  55658. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  55659. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  55660. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  55661. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  55662. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  55663. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  55664. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  55665. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  55666. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  55667. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  55668. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  55669. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  55670. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  55671. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  55672. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  55673. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  55674. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  55675. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  55676. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  55677. -----END CERTIFICATE-----
  55678. UCA Extended Validation Root
  55679. ============================
  55680. -----BEGIN CERTIFICATE-----
  55681. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  55682. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  55683. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  55684. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  55685. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  55686. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  55687. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  55688. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  55689. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  55690. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  55691. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  55692. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  55693. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  55694. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  55695. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  55696. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  55697. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  55698. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  55699. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  55700. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  55701. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  55702. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  55703. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  55704. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  55705. dhh2n1ax
  55706. -----END CERTIFICATE-----
  55707. Certigna Root CA
  55708. ================
  55709. -----BEGIN CERTIFICATE-----
  55710. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  55711. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  55712. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  55713. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  55714. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55715. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  55716. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  55717. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  55718. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  55719. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  55720. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  55721. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  55722. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  55723. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  55724. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  55725. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  55726. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  55727. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  55728. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  55729. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  55730. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  55731. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  55732. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  55733. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  55734. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  55735. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  55736. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  55737. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  55738. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  55739. -----END CERTIFICATE-----
  55740. emSign Root CA - G1
  55741. ===================
  55742. -----BEGIN CERTIFICATE-----
  55743. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  55744. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  55745. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  55746. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  55747. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  55748. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  55749. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  55750. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  55751. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  55752. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  55753. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  55754. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  55755. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  55756. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  55757. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  55758. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  55759. iN66zB+Afko=
  55760. -----END CERTIFICATE-----
  55761. emSign ECC Root CA - G3
  55762. =======================
  55763. -----BEGIN CERTIFICATE-----
  55764. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  55765. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  55766. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  55767. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  55768. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  55769. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  55770. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  55771. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  55772. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  55773. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  55774. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  55775. -----END CERTIFICATE-----
  55776. emSign Root CA - C1
  55777. ===================
  55778. -----BEGIN CERTIFICATE-----
  55779. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  55780. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  55781. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  55782. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  55783. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  55784. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  55785. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  55786. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  55787. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  55788. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  55789. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  55790. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  55791. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  55792. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  55793. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  55794. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  55795. -----END CERTIFICATE-----
  55796. emSign ECC Root CA - C3
  55797. =======================
  55798. -----BEGIN CERTIFICATE-----
  55799. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  55800. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  55801. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  55802. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  55803. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  55804. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  55805. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  55806. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  55807. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  55808. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  55809. -----END CERTIFICATE-----
  55810. Hongkong Post Root CA 3
  55811. =======================
  55812. -----BEGIN CERTIFICATE-----
  55813. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  55814. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  55815. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  55816. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  55817. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  55818. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  55819. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  55820. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  55821. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  55822. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  55823. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  55824. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  55825. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  55826. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  55827. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  55828. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  55829. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  55830. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  55831. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  55832. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  55833. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  55834. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  55835. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  55836. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  55837. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  55838. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  55839. dBb9HxEGmpv0
  55840. -----END CERTIFICATE-----
  55841. <?php
  55842. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  55843. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  55844. }
  55845. setlocale(LC_ALL, 'C');
  55846. require __DIR__.'/../src/bootstrap.php';
  55847. use Composer\Console\Application;
  55848. use Composer\XdebugHandler\XdebugHandler;
  55849. error_reporting(-1);
  55850. // Restart without xdebug
  55851. $xdebug = new XdebugHandler('Composer', '--ansi');
  55852. $xdebug->check();
  55853. unset($xdebug);
  55854. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  55855. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  55856. exit(1);
  55857. }
  55858. if (function_exists('ini_set')) {
  55859. @ini_set('display_errors', 1);
  55860. $memoryInBytes = function ($value) {
  55861. $unit = strtolower(substr($value, -1, 1));
  55862. $value = (int) $value;
  55863. switch($unit) {
  55864. case 'g':
  55865. $value *= 1024;
  55866. // no break (cumulative multiplier)
  55867. case 'm':
  55868. $value *= 1024;
  55869. // no break (cumulative multiplier)
  55870. case 'k':
  55871. $value *= 1024;
  55872. }
  55873. return $value;
  55874. };
  55875. $memoryLimit = trim(ini_get('memory_limit'));
  55876. // Increase memory_limit if it is lower than 1.5GB
  55877. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  55878. @ini_set('memory_limit', '1536M');
  55879. }
  55880. // Set user defined memory limit
  55881. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  55882. @ini_set('memory_limit', $memoryLimit);
  55883. }
  55884. unset($memoryInBytes, $memoryLimit);
  55885. }
  55886. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  55887. // run the command application
  55888. $application = new Application();
  55889. $application->run();
  55890. Copyright (c) Nils Adermann, Jordi Boggiano
  55891. Permission is hereby granted, free of charge, to any person obtaining a copy
  55892. of this software and associated documentation files (the "Software"), to deal
  55893. in the Software without restriction, including without limitation the rights
  55894. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  55895. copies of the Software, and to permit persons to whom the Software is furnished
  55896. to do so, subject to the following conditions:
  55897. The above copyright notice and this permission notice shall be included in all
  55898. copies or substantial portions of the Software.
  55899. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  55900. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  55901. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55902. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  55903. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  55904. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  55905. THE SOFTWARE.
  55906. ”œd»5ß®YEÑuÆ”ÌïaW���GBMB